shell script take two arguments:
- Name of file to be find or searched.
- Directory Name where the file mentioned as argument1 resides.
I am facing problem in getting output of find command when executed via script, I tried to run same command which is used in script runs fine but inside script I am not able get the output, please help me to correct below code.
param_1=$1
param_2=$2
echo "First param: $1"
echo "Second param: $2"
###list="$(find $param_2 -name $param_1 -type f)"
temp_1="find $2 -name "
temp_2=" \"$1\""
###temp_3=" -type f"
final_command=$temp_1$temp_2
echo $final_command
list=`$final_command`
for file in $list; do if [ -f "$file" ]; then echo "Found: $file"; fi; done
sh /home/xyz/find.sh one.txt /home/xyz/