how to execute this bash script

Asked by newub

I've problem running the script on this page

http://www.opencodeproject.com/article.php/44/making+dvds+from+jvc+everio+mod+files+using+ubuntu+winff+avidemux+and+devede

by typing '~/Videos/Video Camera/Converted$ sh EverioNamesHexToDec.sh'
replacing 'Videos/Video Camera/Converted' by my directory path

result is this 'bash: cd: ~documents/mar2009$: No such file or directory'

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu bash Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Ryan Dwyer (ryandwyer) said :
#1

Try: ~/Documents/mar2009

You need a / after the ~, and case sensitivity also matters.

Revision history for this message
newub (fin-mentor) said :
#2

I still get 'No such file or directory'.
My file name is 'hextodec', it is a text file with execute enabled.
Could you tell me the full command please.
I've tried '~/Documents/mar2009$ sh hextodec. sh'

Revision history for this message
Qoquaq (qoquaq) said :
#3

the current directory where the script resides is not in your path. you will need to type the following at the command line

cd ~/Documents/mar2009
/bin/sh ./hextodec.sh

the ./ signifies the current directory
place a #!/bin/sh as your first line in the script such that it calls the shell for you.

happy hacking!

Revision history for this message
newub (fin-mentor) said :
#4

Typing
cd ~/Documents/mar2009
/bin/sh ./hextodec.sh

Displays
/bin/sh: Can't open ./hextodec.sh

Have included #!/bin/sh in first line.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#5

cd ~/Documents/mar2009; ls

Is the filename shown?

if so, run:

chmod +x ./hextodec.sh; ./hextodec.sh

if the file is not there then you are barking up the wrong tree. If you made the file on the desktop the command will be:

cd ~/Desktop; chmod +x ./hextodec.sh; ./hextodec.sh

The pwd (present working directory) is important and the system will not search for files if you misname them. Use the ls (lowercase LS) to check the contents of folders to make sure you can see the file in the pwd, Linux is also VERY VERY case sensitive so if the script name has capitalized letters you MUST match these EXACTLY or it will not work.

Revision history for this message
Qoquaq (qoquaq) said :
#6

good catch actionparsnip! i made too many assumptions

1) chmod +x will allow the script to be an executable file by applying the execute permission.

2) make sure the file is executed in the directory it resides. ./ means current directory. given the aforementioned path in the last post, it was assumed the script resided in ~/Documents/mar2009.

Can you help with this problem?

Provide an answer of your own, or ask newub for more information if necessary.

To post a message you must log in.