0

I'm running Ubuntu 14.04. I've created a script called startup.sh and given it execute permissions. I put it in my $HOME/bin folder, and I've checked and this is indeed on the PATH. I've rebooted my computer just to be sure. I am still unable to run startup.sh just as a command (typing startup on the command line). Am I wrong in what I've done or assumed is possible?

My end goal was to be able to just type on the command line "startup" and execute the script I created.

$ startup
startup: command not found
$ echo $PATH
/home/travis/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
$ cd /home/travis/bin && ls -l
total 4
-rwxrwxr-x 1 travis travis 803 Dec 16 10:08 startup.sh

I can still run the script by navigating to $HOME/bin and running bash startup.sh of course, but that wasn't the goal.

Setting executable permissions and a #!/bin/bash line per How do I run a shell script without using "sh" or "bash" commands? did not work for me as an answer, hence my confusion.

Community
  • 1
  • 1
travisb
  • 33
  • 4
  • If you tried those things, show your work! You don't show `ls -l ~/bin` output (thus, permissions); you don't show output from `echo "$PATH"`; and the code you paste doesn't have a shebang. – Charles Duffy Dec 16 '14 at 18:49
  • ...until amended to **show** -- not tell -- that the other answers don't work, this question is duplicative. – Charles Duffy Dec 16 '14 at 18:50
  • Showing your `.profile` doesn't demonstrate your actual `PATH` in the current session under test. – Charles Duffy Dec 16 '14 at 18:51
  • The problem is he's calling `startup` instead of `startup.sh` – whoan Dec 16 '14 at 18:51
  • @j.a., ...indeed. I don't follow untrusted links as a matter of course -- there's too much ASCII goatse in the world; had the information been included in the question rather than obscured on a 3rd-party site, this would have been a quicker answer. – Charles Duffy Dec 16 '14 at 18:52
  • Noted, next time I won't use a paste web site. Thanks for the help. – travisb Dec 16 '14 at 18:53

1 Answers1

3

If your file is named startup.sh, then the command to run it needs to be startup.sh.

If you want the command to be startup, don't include any extension on your filename: Just name it startup.

Charles Duffy
  • 280,126
  • 43
  • 390
  • 441