problem with output of find command being input to basename command...
Hi,
I am triying to make sure that there exists only one file with the pattern abc* in path /path/. This directory is having many huge files. If there is only one file then I have to take its complete name only to use furter in my script.
I am planning to do like this:
if [ `find /path/abc* | wc -l` == 1 ]; then
x=`find /path/abc*`
y=`basename $x`
fi
I am triying to combine x=`find... and y=`basename... into one sentence using "|".
y=`find /path/abc* | basename`
But I am getting below error:
Usage: basename String [Suffix]
Can any one suggest if there is a better way to do this or help me combine these two commands into one.
Thank you.
|