- A script is a text file of commands, and an interpreter carries it out.
bash filenames the interpreter explicitly,./filetakes it from the shebang, andsh fileon Ubuntu is dash, which does not know bash syntax. - Running a file as a program requires the x permission. A name without
/is looked up only in PATH, so your own commands go into~/bin. - A variable is
name=valuewith no spaces around=. Expand it in double quotes,"$name", or a space will split the value into pieces. - At the start of the lesson
./ran into the missing x permission, the bare name into a PATH without the current directory, andshinto a bracketed list that only bash understands.
Step 6 of 6 · summary · 2 min
Summary
Found an inaccuracy? Report an error in the lesson