Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm having a problem with calling env from the terminal. I'm running the latest Ubuntu OS. Here's what happens:

$ ls
disarm.ss  hereis.ss  mat.ss  README  sg.ss  start-test  syntax.ss
$ env SCHEMEHEAPDIRS=/usr/lib/csv8.1/i3le sg.ss
env: sg.ss: No such file or directory

I have checked that the path /usr/lib/csv8.1/i3le is correct. Here are the permissions of the files in this dir:

$ ls -l
total 60
-rw------- 1 dtdannen dtdannen 17375 2011-03-29 23:05 disarm.ss
-rw------- 1 dtdannen dtdannen  9410 2011-03-29 23:05 hereis.ss
-rw------- 1 dtdannen dtdannen  9955 2011-03-29 23:05 mat.ss
-rw------- 1 dtdannen dtdannen   394 2011-03-29 23:05 README
-rwxrwxrwx 1 dtdannen dtdannen  2801 2011-03-29 23:05 sg.ss
-rwx------ 1 dtdannen dtdannen   137 2011-03-29 23:05 start-test
-rw------- 1 dtdannen dtdannen   678 2011-03-29 23:05 syntax.ss

I can't seem to figure out why env cannot find 'sg.ss'. Is it a problem with permissions? I know you should rarely if ever 'chmod 777' on a file (here I did so on sg.ss), but I just wanted to see if that would make it work. I need to call this command within a python program, not directly via command line, but I get the same error in both cases, so I used the terminal as my example.

Any and all advice is appreciated :)

P.S. I searched SO for at least 20 minutes and couldn't find a similar post. Hope I'm not re-asking something.

EDIT: Tried the same thing but with ./sg.ss instead of just sg.ss (still didn't work, same error :( )

share|improve this question

migrated from stackoverflow.com Mar 30 '11 at 13:10

This question came from our site for professional and enthusiast programmers.

    
search on unix.stackexchange.com –  N 1.1 Mar 30 '11 at 5:06
1  
Unix is not DOS. If . (or an empty entry) is not in PATH, the current directory will not be searched. This is by design, so you don't get trojaned just by being in the wrong directory. :-) –  Chris Jester-Young Mar 30 '11 at 5:10
    
Are you sure the file is named sg.ss? Try ls sg.ss. –  Randy Proctor Mar 30 '11 at 12:23
add comment

3 Answers 3

up vote 1 down vote accepted

Look at the first line in the file sg.ss it most likely starts #!/blah check that /blah exists.

share|improve this answer
    
Yea that was it! Awesome thanks :) –  Dustin Mar 30 '11 at 16:38
add comment

env will search the PATH environment variable to search for your utility, just as your shell's native behavior. Use ./ if you want to refer to the file in current directory, i.e.:

env SCHEMEHEAPDIRS=/usr/lib/csv8.1/i3le ./sg.ss
share|improve this answer
    
@yan, Right, I tried that and it didn't change anything. Still received the same error. –  Dustin Mar 30 '11 at 5:16
add comment

The current directory isn't on the search path, and as sg.ss doesn't contain any slashes, it's taken to be a name to look for in the path (much like the behavior of execl. You want env SCHEMEHEAPDIRS=/usr/lib/csv8.1/i3le ./sg.ss.

share|improve this answer
    
@hobbs,Right, I tried that and it didn't change anything. Still received the same error –  Dustin Mar 30 '11 at 5:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.