Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I know which shell I am using?

Tags:

linux

shell

I am writing a shell script. The tutorial that I am reading have the first line like this :

#!/usr/bin/env bash/

but it isn't working for me. (error : no such directory)

How can I find out which bash I am using and where is it located?

Appreciate for any advice and help.

Thanks a lot. It works now.

solution is #!/usr/bin/env bash

Another problem: Why it just can't read the word 'restart'

my code in the start.sh:

#!/usr/bin/env bash/
RESTART="apachectl restart"
$RESTART

I does not work.

Usage: /usr/local/apache2/bin/httpd [-D name] [-d directory] [-f file]
                                [-C "directive"] [-c "directive"]
                                [-k start|restart|graceful|graceful-stop|sto                                                                             p]
                                [-v] [-V] [-h] [-l] [-L] [-t] [-S]
Options:
-D name            : define a name for use in <IfDefine name> directives
-d directory       : specify an alternate initial ServerRoot
-f file            : specify an alternate ServerConfigFile
-C "directive"     : process directive before reading config files
-c "directive"     : process directive after reading config files
-e level           : show startup errors of level (see LogLevel)
-E file            : log startup errors to file
-v                 : show version number
-V                 : show compile settings
-h                 : list available command line options (this page)
-l                 : list compiled in modules
-L                 : list available configuration directives
-t -D DUMP_VHOSTS  : show parsed settings (currently only vhost settings)
-S                 : a synonym for -t -D DUMP_VHOSTS
-t -D DUMP_MODULES : show all loaded modules
-M                 : a synonym for -t -D DUMP_MODULES
-t                 : run syntax check for config files

why is it like that? it seems that it can read the word restart.

Thank you all! I have fixed it now.

solution: edit the file in unix (vim/nano and whatever but not in windows)

Thank again :)
like image 979
Newbie Avatar asked May 23 '11 07:05

Newbie


2 Answers

Yet another way: echo $SHELL.

like image 193
khachik Avatar answered Oct 20 '22 19:10

khachik


If you remove the / from bash/, it should work.

like image 33
Fred Foo Avatar answered Oct 20 '22 18:10

Fred Foo