Home Man
Today's Posts

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.


recursion, shell scripts

Login to Reply

Thread Tools Search this Thread
# 1  
Old 08-25-2002

I'm using the UNIX csh and i wish to use recursion to nav my way up (or down as it is) a given folder.

My little test script is called "r" and takes a folder as argv[1] (or $1)

#!/bin/tcsh -f
set allFiles = `ls -A $argv[1]`
cd $argv[1]
while ($#allFiles)
if (-d $allFiles[1]) then
echo $allFiles[1]
# do whatever...
r $allFiles[1]
shift allFiles

echo done.

however once it chages into a given dir the script "r" is no longer in the new dir and thus the process fails. I'm not the super user so I can not dump the script "r" in "bin". Can anyone help me do something similair?
# 2  
Old 08-26-2002
Just use the absolute path of r.

instead of
r $allFiles[1]

use /full/path/name/r $allFiles[1]

That was r will always be found wherever you are. At the moment 'r' is only going to be found in the directory you are in.

Alternatively add the location of 'r' to your PATH. Same effect as putting it in bin - the reason that you could find it if it was in bin (regardless of where you are) is that bin is in your path......same logic.

Last edited by peter.herlihy; 08-26-2002 at 03:35 AM..
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Recursion list for rm -R in find port43 UNIX for Advanced & Expert Users 5 06-27-2013 09:15 PM
Recursion in a bash script mistsong1 UNIX for Dummies Questions & Answers 6 04-25-2013 04:29 PM
script recursion superpointer Shell Programming and Scripting 6 02-12-2011 08:24 PM
C Recursion (explain) seede Programming 5 04-26-2010 08:30 PM
Recursion joshighanshyam Programming 5 12-03-2008 11:15 AM
KSH: recursion into subdirectories? Wotan31 Shell Programming and Scripting 2 09-24-2008 03:49 PM
Help Help Help in recursion murtaza Shell Programming and Scripting 6 03-29-2007 10:26 AM
A Question On Recursion In Ksh marlonus999 Shell Programming and Scripting 1 01-11-2007 06:09 AM
allow recursion on dns server? xnightcrawl UNIX for Advanced & Expert Users 1 03-29-2006 09:36 AM
recursion too deep swamy455 Shell Programming and Scripting 3 07-18-2005 03:18 PM

All times are GMT -4. The time now is 01:44 PM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
Show Password