Page 1 of 1 [ 4 posts ] 

jamiethesilent
Raven
Raven

User avatar

Joined: 11 Jul 2010
Age: 23
Gender: Male
Posts: 100
Location: Mid Wales.

11 Jan 2011, 2:43 pm

I write quite a few bash shell scripts. However recently the bang line of the script is not working. When I try to execute the script I get an error on line one: !#bin/bash No such file or dicrectory. As far as I know my syntax for the bang line is correct. I have written several other scripts and they have worked perfectly. I run Zubuntu 10.010

James


_________________
If we knew what it was we were doing, it would not be called research, would it?
-Albert Einstein

- Cruch Bang Linux.


Orwell
Veteran
Veteran

User avatar

Joined: 8 Aug 2007
Age: 30
Gender: Male
Posts: 13,765
Location: Room 101

11 Jan 2011, 2:52 pm

I thought shell scripts started with #! not !#

Aside from that, Ubuntu has moved to dash instead of bash for the default shell, so some scripts that use bashisms might not run properly.


_________________
WAR IS PEACE
FREEDOM IS SLAVERY
IGNORANCE IS STRENGTH


Fuzzy
Veteran
Veteran

User avatar

Joined: 30 Mar 2006
Age: 46
Gender: Male
Posts: 5,532
Location: Alberta Canada

11 Jan 2011, 4:58 pm

jamiethesilent wrote:
I write quite a few bash shell scripts. However recently the bang line of the script is not working. When I try to execute the script I get an error on line one: !#bin/bash No such file or dicrectory. As far as I know my syntax for the bang line is correct. I have written several other scripts and they have worked perfectly. I run Zubuntu 10.010

James


#!/bin/bash... you have the # and ! reversed. You can use the mnemonic crunch bang! to remember the order.


_________________
davidred wrote...
I installed Ubuntu once and it completely destroyed my paying relationship with Microsoft.


LordoftheMonkeys
Veteran
Veteran

User avatar

Joined: 15 Aug 2009
Age: 30
Gender: Male
Posts: 927
Location: A deep,dark hole in the ground

12 Jan 2011, 5:35 pm

Yes, it's she-bang, the she meaning # and the bang meaning !
#!/bin/bash


_________________
I don't want a good life. I want an interesting one.