Bash uses the value formed by expanding the rest of parameter as the new parameter; this is then expanded and that value is used in the rest of the expansion, rather than the expansion of the original parameter. Bash variables are by default global and accessible anywhere in your shell script. Command Line Arguments in Shell Script. This is known as indirect expansion. \c - Suppress the
that otherwise follows the final argument in the output. To have it newline terminated, just add $'\n' to the list of chars to print: $ printf "%c" {a..z} $'\n' $'\n' is bash idiomatic way to represent a newline character. the "" is not necessary (at least for bash) and tail -1 | wc -l can be used to find out the file without a new line at the end â yuyichao Feb 17 '12 at 14:42 5 @yuyichao: The "" isn't necessary for bash, but I've seen echo implementations that print nothing when invoked without arguments (though none of the ones I can find now do this). All characters following the \c in the arguments shall be ignored. The while loop walks through the optstring, which contains the flags that are used to pass arguments, and assigns the argument value provided for that flag to the variable ⦠This output is without a terminating newline because the format string was "%c" and it doesn't include \n. \f - Write a