Date: Tue, 1 Dec 2009 21:04:43 +0100 From: Polytropon <freebsd@edvax.de> To: =?ISO-8859-1?Q?D=E1nielisz_L=E1szl=F3?= <laszlo_danielisz@yahoo.com> Cc: freebsd-questions@freebsd.org Subject: Re: bash script question Message-ID: <20091201210443.0e812d0f.freebsd@edvax.de> In-Reply-To: <560275.79074.qm@web30808.mail.mud.yahoo.com> References: <560275.79074.qm@web30808.mail.mud.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 1 Dec 2009 11:48:43 -0800 (PST), D=E1nielisz L=E1szl=F3 <laszlo_dan= ielisz@yahoo.com> wrote: > I just find out: >=20 > #!/usr/local/bin/bash > export IFS=3D" " > cuc=3D$* > mkdir "cuc" The $* variable will expand to all arguments given on the command line, e. g. $ ./myscript foo bar baz will result in mkdir "foo bar baz" and so create a directory named foo\ bar\ baz including the spaces. If you only want to access the first parameter, use $1, and for good form, check it before further processing. Your use of quotes to include the parameter is already good form. :-) --=20 Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091201210443.0e812d0f.freebsd>