Aituusi
Aituusi

Reputation: 133

How to simulate command line argument in bash shell?

I want to test a shell script using some-script.sh foo on ideone.

In Python we might do something like sys.argv.extend('foo') to simulate command line argument.

How to simulate command line argument in bash?

Upvotes: 0

Views: 612

Answers (1)

choroba
choroba

Reputation: 242103

To populate the variables $1, $2 etc., you can use

set -- arg1 arg2

Upvotes: 3

Related Questions