Quantcast
Viewing latest article 2
Browse Latest Browse All 3

Answer by Oli for Prevent parameter expansion in shell script

I've demonstrated the problem here:

$ pie() { echo $1; }; pie '*'
1 2 3 4 5 file

Expanded. Bother.

But the solution is quite simple. You just need to quote it but in a way that bash will understand. We use double-quotes. It will be replaced with the variable contents but it won't be expanded.

$ pie() { echo "$1"; }; pie '*'
*

Viewing latest article 2
Browse Latest Browse All 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>