Why am I getting “svn: command not found”

Multi tool use
Why am I getting “svn: command not found”
I'm wondering if anyone can help with figure out why my simple bash script is not working, I keep getting:
svn:command not found
even though I have svn installed and it works perfectly outside of my script.
#!/bin/bash
## Get Directory Path From User
printf "n";
printf "Uses of ~/ or . To Designate Directory Structure Will Not Work!n"
printf "n";
printf "Please Enter The FULL Path To The Directoryn"
printf "Where We Shall Create Copy of Slidesn"
read PATH
## If Path Is Valid
if [ -d "$PATH" ]; then
printf "Valid Path To Directory Enteredn"
## Attempt To Copy Files From SVN On Bluenose
`svn checkout https://svn.cs.dal.ca/csci2132/all/slides/ $Path`
printf "All Slides Have Been Copied To "
printf $PATH + "n"
printf "n"
## Invalid Path Entered Tell User And Exit
else
printf "Invalid Path Enteredn";
printf "Please Try Againn";
exit 0;
fi
printf "Task Completen"
svn
Is it safe to read user input into
$PATH
? Wouldn't that destroy the search path for binaries (such as svn
)? Seems safer to choose a different variable name.– Thilo
Oct 26 '15 at 0:00
$PATH
svn
Also, you can get rid of the backquotes around the "svn" command :)
– racraman
Oct 26 '15 at 0:02
Also, I don't think you want backticks around that svn command, it'll send the output as a command.
– woot
Oct 26 '15 at 0:03
1 Answer
1
The shell looks through the colon separated list of directories in PATH to find executables. Since you have used the name PATH to be the target destination, that is where it is looking for svn. Just choose a different name for the variable. That is, do not overwrite PATH.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Your script reads PATH. It looks for the command
svn
in PATH. Pick a different name for the variable.– William Pursell
Oct 25 '15 at 23:59