I am trying to concat "comnp.dat_CY*"
files into one file. File name, source path and destination path are the parameters. I am trying to find the last character in the path to check if it is "/"
or not. But when I try to do that I am getting error. Below is my script
if [ "$#" -ne 3 ]; then
echo "Script requires 3 inputs"
echo "1. File pattern (comnp.dat_CY)"
echo "2. Source path"
echo "3. Destination path"
exit
fi
last_char1 = `echo $2|awk -F '{if (NF>1) {print $NF}}`
last_char2 = `echo $3|awk -F '{if (NF>1) {print $NF}}`
if [ $last_char1 != "/" ];then
ap_src_path = "$2/"
fi
if [ $last_char2 != "/" ];then
ap_dest_path = "$3/"
fi
cat $ap_src_path$1* > $ap_dest_pathcomnp.dat
Below are my errors:
comnp.sh: Broken pipe
comnp.sh[14]: last_char1: not found
comnp.sh[15]: last_char2: not found
comnp.sh[17]: test: argument expected
comnp.sh[20]: test: argument expected
What is wrong in my script?
I am using ksh AIX
/
it is showing error likecomnp.sh[18]: ap_src_path: not found comnp.sh[21]: ap_dest_path: not found
but in this case also it is giving output.what could be the reason – Aravind Dec 02 '14 at 16:28