The beauty of shell scripting in Unix is that there are plenty of commands you can use to get useful output from and reuse it by assigning it to variables.
This section of the Unix Commands website contains such commands. Please contact me if you know of yet another extra-useful command to be included.
Files and directories
- pwd – confirm the current directory you're in
- dirname – extract the directory name from a full path to a file
- basename – strip directory and suffix from a full path to a file