Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
shell script (first few lines mean?
Name: JANET1979 Date: December 7, 2002 at 10:27:37 Pacific OS: XP PRO CPU/Ram: 2G/255DDRAM
Comment:
HI, IAM A UNIX BEGINNER AND IAM A COMPLETELY LOST AS TO WHAT THIS PART OF MY SHELL SCRIPT MEANS?
(ls|while read xx do if [ -f $xx ] ;then
(FULL SCRIPT BELOW)
PLZ HELP, REGARDS 'BEMUSED UNIX ROOKIE', JANET.
#!/bin/sh
ls|while read xx do if [ -f $xx ] ;then dir=$(echo $xx|awk '{print substr( $1, 1, 1)}') if [ ! -d $dir ] ;then mkdir $dir fi mv $xx $dir fi done
Name: Jimbo Date: December 7, 2002 at 11:09:09 Pacific
Reply:
#!/bin/sh
# run the 'ls' command with each outputted # item being read into the variable 'xx' ls|while read xx do
# Check if the item is a regular file if [ -f $xx ] ;then
# extract the first letter of the file into # variable 'dir'. example: file named test # would set the variable $dir to 't' dir=$(echo $xx|awk '{print substr( $1, 1, 1)}')
# if the 'dir' variable is not an existing # directory, create it. if [ ! -d $dir ] ;then mkdir $dir fi
# move the file to the directory # example: mv test t mv $xx $dir fi done
Summary: I am writing a shell script to use ssh. The scripts first proper line is: ssh -l username hostname where username and hostname are proper ones! How can I make the script wait for me to type my passwor...
Summary: Hi all, How can I develop shell script to replace line. for example ========================== xxxxxxxxx yyyyyyyy zzzzzzzzz dd fffffff gffff dddddd zzz ddf rr44w fertt dd fffffff ...
Summary: #!/bin/csh echo "total arguments $#argv" # check the command line arguments. If they are less than 3 then # show the usage message and exit if ( ${#argv} < 3 ) then echo "\n Usage: $0 <n...