Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

shell tip: echo * and printf

Tags: echo testdir

~$ mkdir testdir~$ cd testdir~/testdir$ touch -- -e \\141~/testdir$ ls-e \\141~/testdir$ Echo *a~/testdir$ note i used '--' with touch so '-e' would not be used as an option.So what happened here?-e was passed to echo as an option. echo * becomes echo '-e' '\141' which interpreted correctly the \141 escape sequence as 'a'If you're going to use * be careful. Avoid echo try printf.In this case: ~/



This post first appeared on Unix Art, please read the originial post: here

Share the post

shell tip: echo * and printf

×

Subscribe to Unix Art

Get updates delivered right to your inbox!

Thank you for your subscription

×