neither-nor
neither-nor

Reputation: 1263

bash shell $HOME assignment and script execution

I've just begun learning Unix and have so far encountered two elementary though difficult to resolve problems:

Ex:

$ more .profile
HOME="~/Documents/Basics/Unix/Unix_and_Perl_course"
cd $HOME
[...]
$ source .profile
-bash: cd: ~/Documents/Basics/Unix/Unix_and_Perl_course: No such file or directory

Ex:

$ more hello.sh 
# my first Unix shell script
echo "Hello World"
$ hello.sh
bash: hello.sh: command not found

Thanks!

Upvotes: 1

Views: 3840

Answers (2)

synthesizerpatel
synthesizerpatel

Reputation: 28036

You also don't want to 'overload' $HOME, the default location for HOME is always your home directory. If you goof with that, lots of things will break.

As far as hello.sh - thats because you don't have '.' in your $PATH. (Which is a good thing)

Try:

./hello.sh

If it says it can't execute

chmod 755 hello.sh
./hello.sh

Upvotes: 2

  1. ~ = $HOME
  2. . (pwd) is not in $PATH

Upvotes: 1

Related Questions