Script started on Wed Nov 6 12:30:35 2024 mweeks@air:programs$ echo 6329 6329 mweeks@air:programs$ deleq -h deleq - by Michael Weeks Delete a file if it is equal to another. Given two filenames, determine is f1 == f2, and if so, delete f1. Usage: deleq -h prints this message and quit deleq fname1 fname2 delete fname1 if contents equal fname2's mweeks@air:programs$ history | grep find | grep name 503 history | grep find | grep name mweeks@air:programs$ echo this is not going to work this is not going to work mweeks@air:programs$ find . -name hello mweeks@air:programs$ find . -name hello* find: hello2.c: unknown primary or operator mweeks@air:programs$ find . -name hello* find: hello2.c: unknown primary or operator mweeks@air:programs$ find . -name "hello*" ./hello.c ./unix_ch3/bash_scripts_lab/helloWorld.sh ./unix_ch3/bash_scripts_lab/hello.sh ./hello2.c ./more_programs/hello.c ./C_ch2/hello.c ./C_ch2/hello_parts_c_pgm.c ./C_ch2/hello_3320.c mweeks@air:programs$ find . -name "script3.*" ./unix_ch4/script3.csh mweeks@air:programs$ find C_ch2 -name "hello*" C_ch2/hello.c C_ch2/hello_parts_c_pgm.c C_ch2/hello_3320.c mweeks@air:programs$ find / -name index.html > ~/results.txt mweeks@air:programs$ cd unix_ch4 mweeks@air:unix_ch4$ cat script3.csh #!/bin/csh echo first argument is $1, all args are $* shift echo first argument is $1, all args are $* echo " " echo "Example:" echo "$ script3.csh a b c d" echo "first argument is a, all args are a b c d" echo "first argument is b, all args are b c d" mweeks@air:unix_ch4$ ./script3.cash bash: ./script3.cash: No such file or directory mweeks@air:unix_ch4$ ./script3.csh first argument is , all args are shift: No more words. mweeks@air:unix_ch4$ ./script3.csh a b c d first argument is a, all args are a b c d first argument is b, all args are b c d Example: $ script3.csh a b c d first argument is a, all args are a b c d first argument is b, all args are b c d mweeks@air:unix_ch4$ ssh mweeks@hallertau.cs.gsu.edu mweeks@hallertau.cs.gsu.edu's password: + | GSU Computer Science | Faculty Research Server | HALLERTAU.cs.gsu.edu + No mail. Last login: Mon Nov 4 14:00:23 2024 from 131.96.220.66 mweeks@hallertau:~$ mweeks@hallertau:~$ mweeks@hallertau:~$ crontab -l # Edit this file to introduce tasks to be run by cron. # # Each task to run has to be defined through a single line # indicating with different fields when the task will be run # and what command to run for the task # # To define the time you can provide concrete values for # minute (m), hour (h), day of month (dom), month (mon), # and day of week (dow) or use '*' in these fields (for 'any').# # Notice that tasks will be started based on the cron's system # daemon's notion of time and timezones. # # Output of the crontab jobs (including errors) is sent through # email to the user the crontab file belongs to (unless redirected). # # For example, you can run a backup of all your user accounts # at 5 a.m every week with: # 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/ # # For more information see the manual pages of crontab(5) and cron(8) # # every Friday at 10:30 a.m., post a new homework #30 10 * * 5 /usr/local/bin/addAnotherHmwk.sh # # m h dom mon dow command 45 6 * * 1 /usr/local/bin/addAnotherHmwk.sh 50 6 * * 1 /usr/local/bin/addAnotherLab.sh 0 6 * * * /usr/local/bin/gm_vacation 0 7 * * 3 /usr/local/bin/preview_labs mweeks@hallertau:~$ exit logout Connection to hallertau.cs.gsu.edu closed. mweeks@air:unix_ch4$ ls *sh script2.csh script3.csh mweeks@air:unix_ch4$ ls -l *sh -rwx------ 1 mweeks staff 212 Aug 5 23:48 script2.csh -rwx------ 1 mweeks staff 257 Nov 4 08:25 script3.csh mweeks@air:unix_ch4$ ls -l *sh | awk '{ print $9 }' script2.csh script3.csh mweeks@air:unix_ch4$ ls -l *sh | awk '{ print $9" "$6" "$7 }' script2.csh Aug 5 script3.csh Nov 4 mweeks@air:unix_ch4$ cd ~/Desktop/Projects/MCTS_game/ mweeks@air:MCTS_game$ git status On branch master Your branch is up to date with 'origin/master'. nothing to commit, working tree clean mweeks@air:MCTS_game$ vi MCTS_tree.fig mweeks@air:MCTS_game$ git status On branch master Your branch is up to date with 'origin/master'. nothing to commit, working tree clean mweeks@air:MCTS_game$ vi MCTS_tree.fig mweeks@air:MCTS_game$ cat > newfile this is a new file. mweeks@air:MCTS_game$ git status On branch master Your branch is up to date with 'origin/master'. Untracked files: (use "git add ..." to include in what will be committed) newfile nothing added to commit but untracked files present (use "git add" to track) mweeks@air:MCTS_game$ cat > newfile2 this is another new file. mweeks@air:MCTS_game$ git status On branch master Your branch is up to date with 'origin/master'. Untracked files: (use "git add ..." to include in what will be committed) newfile newfile2 nothing added to commit but untracked files present (use "git add" to track) mweeks@air:MCTS_game$ git status | awk '{ print "git add "$1 }' git add On git add Your git add git add Untracked git add (use git add git add newfile git add newfile2 git add git add nothing mweeks@air:MCTS_game$ git add newfile mweeks@air:MCTS_game$ git add newfile2 mweeks@air:MCTS_game$ cd ~/Desktop/csc3320/programs/ mweeks@air:programs$ cd unix_ch4 mweeks@air:unix_ch4$ ls here_doc.txt script2.csh script3.csh shells_log.txt tok_example mweeks@air:unix_ch4$ cat here_doc.txt cascade:Desktop> sed 's/^/Begin /' < test << EOF heredoc> one two heredoc> heredoc> EOF Begin apple orange Begin grape cherry Begin EOF Begin one two Begin cascade:Desktop> vi test2 cascade:Desktop> cascade:Desktop> cascade:Desktop> vi test2 cascade:Desktop> chmod 700 test2 cascade:Desktop> ./test2 Begin apple orange Begin grape cherry cascade:Desktop> cat test apple orange grape cherry EOF mweeks@air:unix_ch4$ mweeks@air:unix_ch4$ # sed 's/^/Begin /' mweeks@air:unix_ch4$ cat > test apple orange grape cherry mweeks@air:unix_ch4$ sed 's/^/Begin /' < test Begin apple orange Begin grape cherry mweeks@air:unix_ch4$ sed 's/$/ End/' < test apple orange End grape cherry End mweeks@air:unix_ch4$ sed 's/a/A/' < test Apple orange grApe cherry mweeks@air:unix_ch4$ sed 's/a/A/g' < test Apple orAnge grApe cherry mweeks@air:unix_ch4$ sed 's/r/R/g' < test apple oRange gRape cheRRy mweeks@air:unix_ch4$ sed 's/r/ARRR/g' < test apple oARRRange gARRRape cheARRRARRRy mweeks@air:unix_ch4$ echo regular expressions regular expressions mweeks@air:unix_ch4$ echo $SHELL /bin/bash mweeks@air:unix_ch4$ who mweeks console Sep 26 22:02 mweeks ttys000 Oct 2 12:01 mweeks ttys001 Oct 23 14:13 mweeks ttys002 Oct 8 13:02 mweeks ttys003 Oct 2 11:18 mweeks ttys005 Oct 30 10:08 mweeks@air:unix_ch4$ w 13:22 up 40 days, 17:01, 6 users, load averages: 1.42 1.33 1.32 USER TTY FROM LOGIN@ IDLE WHAT mweeks console - 26Sep24 40days - mweeks s000 - 02Oct24 6days -bash mweeks s001 - 23Oct24 - script Nov6_2024.log mweeks s002 - 08Oct24 1day -bash mweeks s003 - 02Oct24 36 -bash mweeks s005 - 30Oct24 1day -bash mweeks@air:unix_ch4$ (date; ls; pwd) > out.txt mweeks@air:unix_ch4$ cat out.txt Wednesday November 06, 2024, 01:23 PM here_doc.txt out.txt script2.csh script3.csh shells_log.txt test tok_example /Users/mweeks/Desktop/csc3320/programs/unix_ch4 mweeks@air:unix_ch4$ echo $USER mweeks mweeks@air:unix_ch4$ whoami mweeks mweeks@air:unix_ch4$ echo $MAIL mweeks@air:unix_ch4$ x="abcdefg" mweeks@air:unix_ch4$ echo $x abcdefg mweeks@air:unix_ch4$ echo $$ 22193 mweeks@air:unix_ch4$ # process id of shell mweeks@air:unix_ch4$ ls here_doc.txt script2.csh shells_log.txt tok_example out.txt script3.csh test mweeks@air:unix_ch4$ cat script2.csh #!/bin/csh echo the name of this file is $0 echo the first argument is $1 echo the list of all arguments is $* echo this script places the date into a temporary file called $1.$$ date > $1.$$ ls -l $1.$$ rm $1.$$mweeks@air:unix_ch4$ ./script2.csh a b c the name of this file is ./script2.csh the first argument is a the list of all arguments is a b c this script places the date into a temporary file called a.23844 -rw-r--r-- 1 mweeks staff 29 Nov 6 13:28 a.23844 mweeks@air:unix_ch4$ ls -l a.23844 ls: a.23844: No such file or directory mweeks@air:unix_ch4$ echo there is a /tmp dir there is a /tmp dir mweeks@air:unix_ch4$ (sleep 30; echo done 1) & [1] 23903 mweeks@air:unix_ch4$ (sleep 30; echo done 2) & [2] 23905 mweeks@air:unix_ch4$ echo done 3; wait; echo done 4 done 3 done 1 [1]- Done ( sleep 30; echo done 1 ) done 2 [2]+ Done ( sleep 30; echo done 2 ) done 4 mweeks@air:unix_ch4$ man kill mweeks@air:unix_ch4$ cd .. mweeks@air:programs$ find . -name "[Cc]ontr*" ./unix_ch14/controlC2.c ./unix_ch14/controlC.c ./unix_ch14/controlC4.c ./unix_ch14/controlC3.c mweeks@air:programs$ cat unix_ch14/controlC.c /* This example is from James Wilson's book "Berkeley Unix: A Simple and Comprehensive Guide", John Wiley & Sons, Inc., New York, 1991, page 171. It sets up a function called "confirm()" that is executed whenever the user presses control-C, allowing this program to handle control-C interrupts. I had to make a few changes to get it to compile, such as changing "int confirm()" to "void confirm()". -MCW, Spring 2008 compile with: gcc controlC.c -o controlC /skiff/local/bin/arm-linux-gcc controlC.c -o controlC_iPAQ */ #include #include #include /* needed for "exit" call */ #include // for fork, sleep void confirm() { char yes_or_no; char carriage_return; printf("\nDo you really want to exit? (Y/N)"); scanf("%c%c", &yes_or_no, &carriage_return); printf("%c\n", yes_or_no); if ((yes_or_no == 'y') || (yes_or_no == 'Y')) { exit(0); } } int main() { int i; /* Set up "confirm" as the function to call on ctrl-C */ signal(SIGINT, confirm); for (i=1; i<=20; i++) { printf("Going through loop number %d\n", i); sleep(1); } } mweeks@air:programs$ mweeks@air:programs$ cd unix_ch14 mweeks@air:unix_ch14$ gcc controlC.c -o controlC mweeks@air:unix_ch14$ ./controlC Going through loop number 1 Going through loop number 2 Going through loop number 3 Going through loop number 4 Going through loop number 5 ^C Do you really want to exit? (Y/N)y y mweeks@air:unix_ch14$ exit exit Script done on Wed Nov 6 13:45:04 2024