●●● ●●●● ●●●●● ●●●● ●●●●● Linux editor ●●●● The most frequently used program in Linux is an editor a good choice of editor to suit your need is crucial to most program developer Common editor in linux are vi (standard linux full-screen editor) emacs(macro reach pico/nano(command driven full-screen editor) joe(word star like editor) Since all UNIX systems have installed vi editor, UNIX experts learn vi Emacs editor are reached in macro for formatting teXt. Therefore, it is good for program developer to write code in different programming anguages Pico, nano and joe editor support full screen and cursor editing. They are good for novices X-Window editors are editors which support window and mouse editing Xemacs and gedit are two examples
Linux editor ⚫ The most frequently used program in Linux is an editor. A good choice of editor to suit your need is crucial to most program developer. Common editor in Linux are, ⚫ vi (standard Linux full-screen editor) ⚫ emacs (macro reach) ⚫ pico/nano (command driven full-screen editor) ⚫ joe (word star like editor) ⚫ Since all UNIX systems have installed vi editor, UNIX experts learn vi. ⚫ Emacs editor are reached in macro for formatting text. Therefore, it is good for program developer to write code in different programming languages. ⚫ Pico, nano and joe editor support full screen and cursor editing. They are good for novices. ⚫ X-window editors are editors which support window and mouse editing. Xemacs and gedit are two examples
●●● ●●●● ●●●●● ●●●● ●●●●● Shell script examples(1/3) ●●●● A bash shell script( Check Temp. sh) for reporting high temperature given an input #!/bin/bash high=33 if[ $l -ge shigh then echo"大大大 High temperature signa1!" e⊥se echo Normal temperature!
Shell script examples (1/3) ⚫ A bash shell script (CheckTemp.sh) for reporting high temperature given an input. #!/bin/bash high=33 if [ $1 -ge $high ]; then echo "*** High temperature signal!" else echo "Normal temperature!" fi
●●● ●●●● ●●●●● ●●●● ●●●●● Shell script examples(2 /3) ●●●● A bash script(hosts. sh ) for setting up hostnames and iP tables for 256 nodes in a cluster #!/bin/bash for i in s(seq 0 255) k=expr $i/16+1 l=expr $ 16+1 echo compute-0-sl 101.sk.$l done
Shell script examples (2/3) ⚫ A bash script (hosts.sh) for setting up hostnames and IP tables for 256 nodes in a cluster #!/bin/bash for i in $(seq 0 255) do k=`expr $i / 16 + 1` l=`expr $i % 16 + 1` echo "compute-0-$i 10.1.$k.$l" done
●●● ●●●● ●●●●● ●●●● ●●●●● Shell script examples( 3/3) ●●●● A csh script(fingerall sh for listing the finger information of all users in the linux workstation #!/bin/csh set username cat /etc/passwd awk -FI iprint $1) foreach i( username echo si finger si end
Shell script examples (3/3) ⚫ A csh script (fingerall.sh) for listing the finger information of all users in the linux workstation #!/bin/csh set username = `cat /etc/passwd |awk –F':' '{print $1}'` foreach i ( $username ) echo $i finger $i end