Tagged Questions
1
vote
2answers
81 views
Shell script execution
I have two shell script files with exactly the same permissions etc.
I can run one of them by just giving its name in the command line but for the other one I should use sh or ./ to run it.
What is ...
4
votes
2answers
47 views
Specifying a generic interpreter for a program like expect?
I am writing expect script which can be used on mulple operating systems but the problem is
i can't use #!/usr/bin/expect evreywhere so instead i tried to do
#!`which expect`
at the top but it ...
20
votes
5answers
3k views
Can a script be executable but not readable?
Is it possible to execute a script if there is no permission to read it? In root mode, I made a script and I want the other user to execute this script but not read it. I did chmod to forbid read and ...
17
votes
8answers
7k views
Different ways to execute a shell script
There a several ways to execute a script, the ones I know are:
/path/to/script # using the path (absolute or relative)
. script # using the . (dot)
source script # using the `source` command
...
3
votes
3answers
429 views
In Unix speak what is the difference between a shell script and an executable?
I have seen this question on this site and this prompted me to ask this question . I want to know in Unix speak what is the difference between an executable and a shell script ?
2
votes
1answer
592 views
Calling java from Bash: “Cannot execute binary file”
I have this simple Bash script:
#!/bin/bash
java -jar ClosureCompiler/compiler.jar --js ../src/typescript.js --js ../src/ts-compiler.js --js_output_file TSCompiler.js
I'm getting this error when I ...
5
votes
1answer
1k views
Executing a script in zsh - file permissions
I'm confused about execute file permissions not behaving as I expect. Probably because my expectations are wrong. Anyway:
I have a script file, for simplicity is just called s, located in ~/bin. For ...
5
votes
2answers
226 views
vim: create file with +x bit
Is there any way to set +x bit on script while creating?
For example I run:
vim -some_option_to_make_file_executable script.sh
and after saving I can run file without any additional movings.
ps. ...
1
vote
3answers
614 views
How do I run a windows executable in linux shell script?
I have an executable program (no source code, just the compiled executable) that was made in windows (.exe extension). It doesn't use any graphics... it simply reads and writes files. I want to be ...
5
votes
2answers
144 views
Is it safe to remove a script file from within that script?
Imagine I have a script foo. It should be run once when the user logs in and isn't needed after a successful run.
My question: Is it safe to remove the script file from within the script?
E.g.:
...
10
votes
5answers
2k views
How can I use environment variables in my shebang?
I have a Python script that need to be run with a particular python installation.
Is there a way to craft a shebang so that it runs with $FOO/bar/MyCustomPython?
5
votes
1answer
121 views
How would one detect if external command exists in a script?
Is there a way to detect if an external command exists (i.e. wget, svn)?
More specifically today, i was trying to run one of my scripts i wrote and the person didn't have wget or svn installed.
The ...
3
votes
1answer
9k views
./executable: cannot execute binary file
I have a script that works well when I ssh to the server to execute it myself, but has problems when Hudson, a continuous integration server, runs it.
I am automating tests on an embedded linux ...