Bash function not working…
Paul Smith
paul at mad-scientist.net
Tue Jan 8 15:59:30 UTC 2013
On Tue, 2013-01-08 at 16:38 +0100, Johnny Rosenberg wrote:
> speltid () {
> ffmpeg -i $1 2>&1 | \
First rule of shell scripting (suitable for framing):
ALWAYS QUOTE EVERY VARIABLE REFERENCE!
That's also the second and third rules :-). There are some limited
situations where quoting is not needed, but unless you're really clear
on them it's easier to just always quote.
If you ever see a security hole, broken capability in strange use-cases,
or whatever reported in a shell script, 9 times out of 10 it's due to
unquoted variables.
Change your function to use "$1" instead of just $1 and you'll have
better luck.
Cheers!
More information about the ubuntu-users
mailing list