I want to build a shell script to execute the following two commands, but the shell complains that it does not know about the parameters clean or reload.
make -f '/home/ec2-user/infx/infx.mak' clean
make -f '/home/ec2-user/infx/infx.mak' reload > '/home/ec2-user/infx/mylog.txt' 2>&1
I would like to make a variable out of the directory as well, but when trying to concat the directory and infx.mak I am having even more issues.
Thanks for your help
Code and Errors:
echo "Cleaning Project"
make -f '/home/ec2-user/infx/infx.mak' clean
echo "Making Project"
make -f '/home/ec2-user/infx/infx.mak' reload > '/home/ec2-user/infx/mylog.txt' 2>&1
srcdir='/home/ec2-user/infx'
srcmak='/infx.mak'
echo "$srcmak$srcdir"
exit 0
[ec2-user@ip infx]$ sudo ./reload.sh
'. Stop. No rule to make target `clean
: ambiguous redirect 1
/home/ec2-user/infx
The error message looks like you have DOS line endings in your script. Try dos2unix
or tr -d '\\015'
to fix it. (Google for a bit if you need help; this is a very common problem.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.