Lab setup data from the Pluralsight course on:
Getting Started with the Linux Command Line
The Complete Obsolete Guide to Generative AI (from Manning) is a lighthearted look at programming with AI, as well as a rock-solid resource for getting the most out of these insanely powerful services. Let it be your guide to analyzing massive data sources, summarize pages and pages of text, and scour the live internet.
Parsing a data stream
cut -d: -f3 /etc/group cut -d: -f3 /etc/group | sort -n cut -d: -f3 /etc/group | sort -rn
Writing a file from standard error
wget pluralsight.comm 2> errorfile.txt
Using command substitution
cd /lib/modules/`uname -r`/kernel
Working with user inputs
#!/bin/bash declare -i number1 declare -i number2 declare -i total echo "What's your favorite number? " read number1 echo "What number do you really hate? " read number2 total=$number1*$number2 echo "Aha! They equal " $total exit 0
Looping with for
#!/bin/bash
for i in {0..10..2}
do
echo "We've been through this $i times already!"
done
##################################
#!/bin/bash
for filename in file1 file2 file3
do
echo "Important stuff" >> $filename
done
if-else controls
#!/bin/bash
echo "What's your favorite color? "
read text1
echo "What's your best friend's favorite color? "
read text2
if test $text1 != $text2; then
echo "I guess opposites attract."
else
echo "You two do think alike!"
fi
exit 0
Counting with while
#!/bin/bash
declare -i counter
counter=10
while [ $counter -gt 2 ]; do
echo The counter is $counter
counter=counter-1
done
exit 0
Testing input using case
#!/bin/bash
echo "What's tomorrow's weather going to be like?"
read weather
case $weather in
sunny | warm ) echo "Nice! I love it when it's " $weather
;;
cloudy | cool ) echo "Not bad..." $weather" is ok, too"
;;
rainy | cold ) echo "Yuk!" $weather" weather is depressing"
;;
* ) echo "Sorry, I’m not familiar with that weather system."
;;
esac
exit 0


