I’m having a little issue with a script I’m writing… let’s say I have 2 functions :
function foo1 {
while [ $# -gt 0 ]; do
echo $1
shift
done
}
function foo2 {
foo1 $@
}
My problem is the following. If I do foo1 -o "file with space.txt" output is
-o
file with space.txt
But with foo2 -o "file with space.txt" or foo2 -o file\ with\ space.txt, I get
-o
file
with
space.txt
Is there any way that foo1 receives “file with space.txt” from foo2 ?
In function foo2, use double quotes:
See
man bashfor details: