Skip to content

Instantly share code, notes, and snippets.

@ziz
Created August 14, 2012 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ziz/3349556 to your computer and use it in GitHub Desktop.
Save ziz/3349556 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo $1;
while shift; do
echo $1;
done
+ foo='a b c '\''*'\'' d e f'
+ echo 'no quotes'
no quotes
+ ./bar.sh a b c ''\''*'\''' d e f
a
b
c
'*'
d
e
f
+ echo quotes
quotes
+ ./bar.sh 'a b c '\''*'\'' d e f'
a b c '*' d e f
#!/bin/bash
set -x
foo="a b c '*' d e f"
echo "no quotes"
./bar.sh $foo
echo "quotes"
./bar.sh "$foo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment