From owner-freebsd-questions@freebsd.org Wed Feb 1 01:26:09 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F28B5CCB491 for ; Wed, 1 Feb 2017 01:26:09 +0000 (UTC) (envelope-from bourne.identity@hotmail.com) Received: from SNT004-OMC2S12.hotmail.com (snt004-omc2s12.hotmail.com [65.55.90.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "*.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B2D4F619 for ; Wed, 1 Feb 2017 01:26:08 +0000 (UTC) (envelope-from bourne.identity@hotmail.com) Received: from EUR03-AM5-obe.outbound.protection.outlook.com ([65.55.90.73]) by SNT004-OMC2S12.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Tue, 31 Jan 2017 17:26:07 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=S5hPKnRXwFRgBnOM4ieGK+DptKPRhyn+nt9S/NEEQSY=; b=V1fFkTE3n1aSucn3v0DPD5dHf9HJZ9Yod/DCgjEWqxsw1OASNZzJI2Nt0NUth0IdLYzC61wXIF2/4L9yb4CiG3FK/M+emixc5kUW9TVRaooFQMupnnap0kSQGUr6C+5ffuM2sCTWGLRef14trdURdQ4aPLUHD9IngZw1EXFGbKeQEfqhUQjGGD6AjQmCkZlx20HweI/Y45U2/pxnYy5AKUZIuH8z9wztcyiaR1NdiyKwmq1rnDbLJ+u9F+Oxc/Wtby9vrI2f/PoQku7XyUsT25ApkpQ5J/RY1kZvurOoMpvkrXcWCcShIXkCaY7kzXlexZeit6ddzhLM2FR2uPa7aw== Received: from AM5EUR03FT060.eop-EUR03.prod.protection.outlook.com (10.152.16.60) by AM5EUR03HT012.eop-EUR03.prod.protection.outlook.com (10.152.16.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.8; Wed, 1 Feb 2017 01:26:06 +0000 Received: from VI1PR02MB0974.eurprd02.prod.outlook.com (10.152.16.59) by AM5EUR03FT060.mail.protection.outlook.com (10.152.16.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.2 via Frontend Transport; Wed, 1 Feb 2017 01:26:06 +0000 Received: from VI1PR02MB0974.eurprd02.prod.outlook.com ([10.163.162.28]) by VI1PR02MB0974.eurprd02.prod.outlook.com ([10.163.162.28]) with mapi id 15.01.0860.026; Wed, 1 Feb 2017 01:26:05 +0000 From: Manish Jain To: "freebsd@edvax.de" CC: "freebsd-questions@freebsd.org" Subject: Re: Variable assignment in sh Thread-Topic: Variable assignment in sh Thread-Index: AQHSe9Ozx1G+Ill1IUyNhXhQraLRzKFSst8AgAAfsYCAAAr2gIAAAZEAgABBkQCAADGhAIAAClOA Date: Wed, 1 Feb 2017 01:26:05 +0000 Message-ID: References: <20170131161824.a9f1ef46.freebsd@edvax.de> <20170131185103.7f911dfb.freebsd@edvax.de> <5f51e2c3bdb8a20c6a7786c2b345c957.squirrel@webmail.harte-lyne.ca> <20170201014858.eec196d0.freebsd@edvax.de> In-Reply-To: <20170201014858.eec196d0.freebsd@edvax.de> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: edvax.de; dkim=none (message not signed) header.d=none;edvax.de; dmarc=none action=none header.from=hotmail.com; x-incomingtopheadermarker: OriginalChecksum:A669259CA885F957A7E9CC9F2EEB452840FD502F335E03A9A556EF5594E29063; UpperCasedChecksum:28632A2B72131A766A3ABB4CAEFFBEB3AC31F64D48816BB421E93A8074D4DB28; SizeAsReceived:7986; Count:37 x-ms-exchange-messagesentrepresentingtype: 1 x-incomingheadercount: 37 x-eopattributedmessage: 0 x-microsoft-exchange-diagnostics: 1; AM5EUR03HT012; 7:JloKH5EFfyfARskA5WkueOmEbHl8EQTG3K1ymnKomexZkxfOmDV3FsMelweNJZE1IovXUW94VFDqrcM3sHOhcBEMtpS2Fdadu3++YWrPGGKgx31wv8jWXyrVtFXLv9/aptt9P3KTkHyKaJhkWwRCHYfv/Wtvs89SfQSNTrwunQoP5/Ik9RD9dWjGkpSgF1O1uQtqvWfDNh8qVAEyZX5nh7sN2T0l6FC3ToAnlgMC7dewCTXtqLuiu4ZjKK1SifNIA/AD1EFnsXSZsLFH7DS7POCjVQym/IWVH8rKJsW4tC7fALcHVj6ZoY2qjwBFO3/1y4n+tUkn2FalrX7PYPYdbgbZ6A2xFpJ9j1wBqkyfNx3rBcUONAgrOzpjPHJzbLg0abiMdnvpXAXwaw+oVBc6slof+QhJPvDb3mGi+QVd81td8/nGAB33MWNoxyXG/GKCp6phJJ4EUX+9WX9vMKvbtw== x-forefront-antispam-report: EFV:NLI; SFV:NSPM; SFS:(10019020)(98900005); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5EUR03HT012; H:VI1PR02MB0974.eurprd02.prod.outlook.com; FPR:; SPF:None; LANG:en; x-ms-office365-filtering-correlation-id: 4a2d4fee-026d-47da-bc82-08d44a414a09 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(1601124038)(5061506344)(1603103118)(1601125047)(1701031028); SRVR:AM5EUR03HT012; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444111334)(444112120)(432015012)(82015046); SRVR:AM5EUR03HT012; BCL:0; PCL:0; RULEID:; SRVR:AM5EUR03HT012; x-forefront-prvs: 0205EDCD76 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="Windows-1252" Content-ID: <54A602A8B5C0CC468932E26872D2779B@eurprd02.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Feb 2017 01:26:05.5895 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5EUR03HT012 X-OriginalArrivalTime: 01 Feb 2017 01:26:07.0997 (UTC) FILETIME=[29DCC2D0:01D27C2A] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2017 01:26:10 -0000 On 02/01/2017 06:18 AM, Polytropon wrote: > Additionally, it helps to write portable scripts (across > different operating systems), not just for FreeBSD systems A point here for bash scripting. I earlier used to shebang with the path=20 to bash : #!/usr/local/bin/bash Since my scripts sometimes needed to be ported to Linux and/or Cygwin, I=20 often hacked the system with a symlink /bin/bash that pointed to the=20 actual bash. Then I would use the symlink path - that worked under both=20 FreeBSD and Linux. But a much better way now exists with env : #!/usr/bin/env bash The above shabang always works, no matter what the system, is fully=20 portable, and is not too much typing either. Regards Manish Jain