From owner-freebsd-questions@FreeBSD.ORG Tue Dec 1 20:06:38 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A35F106566C for ; Tue, 1 Dec 2009 20:06:38 +0000 (UTC) (envelope-from lazlar@lazlarlyricon.com) Received: from proxy2.bredband.net (proxy2.bredband.net [195.54.101.72]) by mx1.freebsd.org (Postfix) with ESMTP id 153618FC13 for ; Tue, 1 Dec 2009 20:06:37 +0000 (UTC) Received: from ipb2.telenor.se (195.54.127.165) by proxy2.bredband.net (7.3.140.3) id 4AD3E1BC015FDE57 for freebsd-questions@freebsd.org; Tue, 1 Dec 2009 21:06:36 +0100 X-SMTPAUTH-B2: X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: An5NAIoFFUtV44PPPGdsb2JhbACBTo5miGCCVQEBAQE3vFGEMQSFZQ X-IronPort-AV: E=Sophos;i="4.47,322,1257116400"; d="scan'208";a="10195807" Received: from c-cf83e355.09-42-6e6b7010.cust.bredbandsbolaget.se (HELO lazlar.kicks-ass.net) ([85.227.131.207]) by ipb2.telenor.se with ESMTP; 01 Dec 2009 21:06:35 +0100 Message-ID: <4B15774A.5040700@lazlarlyricon.com> Date: Tue, 01 Dec 2009 21:06:34 +0100 From: Rolf G Nielsen User-Agent: Thunderbird 2.0.0.23 (X11/20091130) MIME-Version: 1.0 To: =?ISO-8859-1?Q?D=E1nielisz_L=E1szl=F3?= References: <560275.79074.qm@web30808.mail.mud.yahoo.com> In-Reply-To: <560275.79074.qm@web30808.mail.mud.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Cc: freebsd-questions@freebsd.org Subject: Re: bash script question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 20:06:38 -0000 D=E1nielisz L=E1szl=F3 wrote: > I just find out: >=20 > #!/usr/local/bin/bash > export IFS=3D" " > cuc=3D$* > mkdir "cuc" >=20 > Thanks anyway! >=20 > L=E1szl=F3 >=20 >=20 >=20 > ________________________________ > From: D=E1nielisz L=E1szl=F3 > To: freebsd-questions@freebsd.org > Sent: Tue, December 1, 2009 8:37:04 PM > Subject: bash script question >=20 >=20 > Hello, >=20 > I'd like to ask how can I read a variable in the same line when I launc= h a script? > For example "./script.sh directory_name", and I want the script to crea= t the directory called "directory_name" or whatever I input there. >=20 > Thank you! > L=E1szl=F3 >=20 >=20 >=20 > =20 > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd= =2Eorg" >=20 >=20 >=20 Why are you using bash? To make a shell script as portable as possible,=20 use /bin/sh. Bash is a third party shell, that isn't included in a base=20 installation (you're not using bash as root's shell, are you?). By using = /bin/sh, you make sure the script will run without having to install any = ports. Try this instead (check the "Special parameters" section in the sh(1)=20 man page to get the difference between $* and $@ and an explanation as=20 to why I quote the $@). #!/bin/sh mkdir "$@" Cheers, Rolf Nielsen