Originally posted by Andrew Monkhouse:
Didn't you get told about the basename command a few days ago?
Here is an awk statement that does the same thing:
Hopefully you will either look at the man pages and work out how this command works, or you will ask about anything you are confused about. If I were an instructor and someone handed in that as a solution to a homework assignment then I would ask them to explain it.
Regards, Andrew
Thanks Andrew , apology for asking very simple questions and annyoing you! :roll:
but here i am working hard reading man pages too and googling but i never get what i wanted to have
and i tried a lot using this logic
# Finds file in the current directory, (including its sub directories) if success then returns file name with extension else it returns null
fSearch()
{
echo $(find $1 -name $2 -type f)
count=$(find $1 -name $2 -type f | tr -cd '/' | wc -c)
echo $count
let lastField=count+1
echo $lastField
name=$(find $1 -name $2 -type f | cut -f $lastfield -d '/')
echo $name
}
path="."
fname=xy*.*
fSearch $path $fname
echo $name
It's working fine but complex.
so i asked for your help thanks a lot andrew!!