Charlotte Curtis March 12, 2026
Resources used:
Why these topics together? They both seem relevant to assignment 3
sh
%pip install -q some_package
command_name --long_flag -l -o arg1 arg2
ls
cd
mv
head
grep
sed
curl
Variables are defined with = and accessed with $
=
$
File arguments are passed as $1, $2, etc. in bash scripts
$1
$2
name="Salvador" echo "Hello, $name!"
Quotes matter!
"
'
`
for file in **/*.csv; do echo "Processing $file" # Do something with $file done
**/
*.csv
.csv
data_*.csv
cat data.csv | grep -o "\d{3}[-\s]?\d{3}-\s]?\d{4}" | wc -l
|
cat
data.csv
wc -l
> sends output to a file, overwriting it
>
>> appends output to a file
>>
< reads input from a file (less )
<
echo "Hello, world!" > greeting.txt echo "\nNext line" >> greeting.txt some_program < saved_inputs.txt
You might also see 2>, which redirects error messages instead of output, or &> which redirects both
2>
&>
Enough of bash for now, you'll practice more in the lab...
Example: let's fill out a data card for the OKCupid data