I am new to UNIX and shell programming. I am trying to make a command lines text file executable by using chmod
command.
Below are the codes:
$ls
a aa aba chapt1 chapt2 chapt3 newprog
$filename=ch
$cat newprog
echo a?* n* ${filename}*
$chmod +x newprog
$ls -l newprog
-rwxr-xr-x 1 xxxxx xxxxx 25 Apr 12 09:50 newprog
But when I execute newprog by
newprog
I got
newprog: command not found
I create newprog by using vi command and I am using putty. Which part did I do wrong?
Thanks to Benjamin W. By using ./newprog, the file is executable.
But the result is
aa aba newprog a aa aba chapt1 chapt2 chapt3 newprog
I think the result that I expect is
aa aba newprog chapt1 chapt2 chapt3
Why there are duplicates?