Another C-Shell question
PostPosted: Tue Apr 25, 2006 12:54 pm
I have to write a C-shell script for homework tonight, and I'm having some problems.
See, I have to make use of a `ls -1R ~` command. This should display each file and directory in my account on a new line.
However, my account looks something like this...
~/[files]
~/[directories with files]
~/backup/[backups of all my dirs and files]
~/backup/backup/[?]
this strange ~/backup/backup directory is driving me nuts. I can't look inside of it or do anything with it without getting errors (Error: /afs/sfsu.edu/mail2/nbyrd/backup/backup: Number of symbolic links encountered during path name traversal exceeds MAXSYMLINKS). And if a cshell script hits an error in execution, it bombs out and doesn't execute the rest of the script. Thus, when that ls -1R command is reached in my script, the whole thing comes to a full-stop because of that error.
Now, there's nothing I can do about the error; it's set in stone by the system admins to keep people from crashing the processor (which has happened in the past). I don't really keep any valuable information on the school server in my account, so I thought I'd try deleting everything inside the ~/backup/ folder... turns out I'm not allowed to do that.
So my last resort is trying to find a way around the backup directory with the ls command. However... I don't know of any way to make ls simply "ignore" or "skip" over directories when the Recursive option is flipped on. Any help?
Edit: Hahaha, this backup\backup even has grep trippin...
Grasping for straws now, eh?
Edit2: lol, figured it out.. but there has to be an easier way...
See, I have to make use of a `ls -1R ~` command. This should display each file and directory in my account on a new line.
However, my account looks something like this...
~/[files]
~/[directories with files]
~/backup/[backups of all my dirs and files]
~/backup/backup/[?]
this strange ~/backup/backup directory is driving me nuts. I can't look inside of it or do anything with it without getting errors (Error: /afs/sfsu.edu/mail2/nbyrd/backup/backup: Number of symbolic links encountered during path name traversal exceeds MAXSYMLINKS). And if a cshell script hits an error in execution, it bombs out and doesn't execute the rest of the script. Thus, when that ls -1R command is reached in my script, the whole thing comes to a full-stop because of that error.
Now, there's nothing I can do about the error; it's set in stone by the system admins to keep people from crashing the processor (which has happened in the past). I don't really keep any valuable information on the school server in my account, so I thought I'd try deleting everything inside the ~/backup/ folder... turns out I'm not allowed to do that.
So my last resort is trying to find a way around the backup directory with the ls command. However... I don't know of any way to make ls simply "ignore" or "skip" over directories when the Recursive option is flipped on. Any help?
Edit: Hahaha, this backup\backup even has grep trippin...
- Code: Select all
libra% ls -1R | sort | cut -f1 -d':' | grep '^\..*' | grep -v '.*backup.*'
./backup/backup: Number of symbolic links encountered during path name traversal exceeds MAXSYMLINKS
./Mail
./bin
./cstuff
./homework/csc212/temp/paint
./homework/csc212/temp
./homework/csc212
./homework
./mail
./private
./public_html
./student/physics/lab
./student/physics
./student/prgm
./student
./temp
.
Grasping for straws now, eh?
Edit2: lol, figured it out.. but there has to be an easier way...
- Code: Select all
ls -1R >& junkfile
foreach vari (`sort junkfile | cut -f1 -d':' | grep '^\..*' | grep -v '.*backup.
*'` )
(etc etc etc)
end
rm junkfile