I will use a “Bash command line” heading for lines we type at the command prompt
I will use a “Bash script” heading for lines we type in a file
echo-e"Hello, World!"Precision (spelling, case, and spaces) matters
echo command
man is the command (program) and echo is an argument
pwd shows the path to your current location in the file system (print working directory)
ls lists files and directories
Let’s make 2 new directories move into/out of them
How to get home?
$HOME and ~ are just variables for your home directory
whereis is a command for finding files in your PATH
/bin/pwd is because /bin is in your PATHpwd, Bash will look for it in these directoriesLet’s make a file with one word in it
>” redirects the output of echo into the file “file1.txt”Let’s make 2 more files
Let’s loop over the files and print their content
We can use wildcards to make this easier
?” will match any character at that positionLet’s make a file and open it with a text editor
(I use VS Code below, but you can use any text editor)
VS Code might open an authentication prompt; use your AU password
Add these lines to my_bash_script.sh
Save and close the my_bash_script.sh file
Now, you can run my_bash_script.sh as a script with Bash!
Not required! But, if you want to use a Unix-like command line on your computer, you can!
You have a Terminal app already
I recommend installing Xcode command line tools
Open terminal and use this command:
You can install Linux via the Windows Subsystem for Linux (WSL)
I recommend you use the default Linux distribution (Ubuntu)
Running WSL will be very similar to Red Hat (ThinLinc)
Here’s a nice lesson from Software Carpentries
This work was made possible by funding provided to Jamie Oaks from the National Science Foundation (DEB 1656004).