0

I would like to execute a command like this:

#!/bin/sh
`which rvmsudo` `which program` argument

but I get this issue

/usr/bin/env: argument: No such file or directory
2
  • You want to pass the argument you give to the script as the argument to the command inside the script? Then you should change the argument to $1 Commented Jan 2, 2012 at 10:37
  • unrelated to your error but you must use #!/bin/bash if you really want bash, otherwise your script will run in compatibility mode (POSIX) Commented Jan 2, 2012 at 21:36

1 Answer 1

2

Make sure, all of the which statements return valid:

#!/bin/bash

RVMSUDO=`which rvmsudo`
test -z "$RCMSUDO" && exit 1

PROGRAM=`which program`
test -z "$PROGRAM" && exit 2

$RVMSUDO $PROGRAM argument
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.