I am attempting to write a script that will work on files stored in an array. 
The function is supposed to strip the files extension and then store the name 
of the file as a variable. This is what I have so far.
 
#!/usr/local/bin/bash

declare -a fname
declare -i count
declare -i limit

fname=( `ls *.sh | tr '\n' ' '` )
count=${#fname[*]}
limit=0

while [ ${limit} -lt ${count} ]; do
echo ${fname[$limit]} | sed -e ``/.sh/s///''
# do something here
limit=$((limit+1))
done
 
What I want to do is store the file in a variable. I have tried this:
 
F_Name=echo ${fname[$limit]} | sed -e ``/.sh/s///''
 
As well as:
 
F_Name=( `echo ${fname[$limit]} | sed -e ``/.sh/s///''` )
 
along with several different variants of it, but without success. I continually 
receive an error message. Due to a particular situation, I cannot use 
'basename' to accomplish this task.
 
Is there anyway that this can be done?
 
Thanks!
-- 
White Hat 
[EMAIL PROTECTED]


      
____________________________________________________________________________________
Get easy, one-click access to your favorites. 
Make Yahoo! your homepage.
http://www.yahoo.com/r/hs 
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to