My version of bash is:
bash --version GNU bash, version 4.2.45(1)-release (x86_64-pc-linux-gnu) If I do the prototype function
#!/bin/bash function f() { echo "hello" $1 } f "world" I get Syntax error: "(" unexpected
Why is that?
Output of shopt is:
autocd off cdable_vars off cdspell off checkhash off checkjobs off checkwinsize on cmdhist on compat31 off compat32 off compat40 off compat41 off direxpand off dirspell off dotglob off execfail off expand_aliases on extdebug off extglob on extquote on failglob off force_fignore on globstar off gnu_errfmt off histappend on histreedit off histverify off hostcomplete off huponexit off interactive_comments on lastpipe off lithist off login_shell off mailwarn off no_empty_cmd_completion off nocaseglob off nocasematch off nullglob off progcomp on promptvars on restricted_shell off shift_verbose off sourcepath on xpg_echo off
cat -A filename. It expands control characters to printable forms, and adds a$to the end of each line.kshor some other non-bash shell.dash foo.bashorsh foo.bash(/bin/shis a symlink todashon my system). The#!/bin/bashline causes your script to be interpreted by bash -- but only if you invoke it directly, not if you feed it to some other shell.