Linked Questions

64 votes
4 answers
285k views

So my question is how can I pass a file argument to my bash script using a Terminal command in Linux? At the moment I'm trying to make a program in bash that can take a file argument from the Terminal ...
AZorin's user avatar
  • 749
81 votes
2 answers
65k views

I want to write a bash script which takes different arguments. It should be used like normal linux console programs: my_bash_script -p 2 -l 5 -t 20 So the value 2 should be saved in a variable called ...
Pascal's user avatar
  • 2,222
14 votes
5 answers
12k views

I need to write a bash script, and would like it to parse unordered parameters of the format: scriptname --param1 <string> --param2 <string> --param3 <date> Is there a simple way to ...
Brent 's user avatar
  • 17k
7 votes
1 answer
36k views

I am new to bash scripting and I need your support to solve this problem. I have a bash script "start.sh". I want to write a script with two arguments so that I could run the script in the following ...
user1983063's user avatar
4 votes
2 answers
10k views

I am new to bash. Need suggestion for the following problem. So I want to execute the script in this way ./myscript --bootstrap bootstrap.exe --vmmount ./vmmount --image /dev/sdb2 --target-exe ...
Reuben's user avatar
  • 5,756
8 votes
1 answer
36k views

I written the following script which gets name of a file and then assemble and link the file. But it doesn't work. What is the problem with it? EXPECTED_ARGS=2 if [ $# -ne $EXPECTED_ARGS ] then ...
user avatar
4 votes
1 answer
10k views

I'm writing a simple bash script and I would like it to accept parameters from the command line in any order. I've browsed around the web and wrote a simple function with a case statement in a while ...
dkd6's user avatar
  • 85
2 votes
3 answers
8k views

So I've been reading around about getopts, getopt, etc. but I haven't found an exact solution to my problem. The basic idea of the usage of my script is: ./program [-u] [-s] [-d] <TEXT> Except ...
sicklybeans's user avatar
1 vote
1 answer
11k views

Here is my Bash script. Assuming that : 1) go.sh is the script to execute 2) the user will launch the script this way # ./go.sh -v file1.txt file2.txt or # ./go.sh --verbose file1.txt file2.txt 3)...
Solid.Snake's user avatar
3 votes
1 answer
4k views

I have a bash script in which I want to check if a flag with value was passed to it and then use the value in a variable. Something like this (pseudocode): file.sh -c 1.0.0 inside file.sh : #!/bin/...
Scooby's user avatar
  • 3,641
1 vote
2 answers
5k views

I am having problem allowing my script to take more than three arguments. My script will take commands like this, for example: ./myscript.sh -i -v -r filename so far if it only takes two arguments ...
jojo so's user avatar
  • 11
7 votes
2 answers
2k views

When writing Bash scripts, how can I obtain a value from the command-line when provided as part of option flags in the command line? For example in the following: ./script --value=myText --...
BWHazel's user avatar
  • 1,464
0 votes
1 answer
4k views

hello all newbie here :D i am working on a project right now which involves a script that handles a *.dat file.The script runs under specific commands inputed by user my problem is that i cant ...
Pantelos Papado's user avatar
1 vote
3 answers
1k views

I have a loop to parse command line arguments. Everything works fine if -d or -b argument has a parameter. But when I pass -d or -b without a parameter, the script gets into infinite loop. # Parse ...
Paweł Madej's user avatar
  • 1,289
0 votes
1 answer
2k views

Basically I am making a script where I would like to give a list of parameters to some option, say -l, eg: usr@domain:$./somescript -l hi bye cry nigh The list specified to -l would be then stored ...
Zage12's user avatar
  • 5

15 30 50 per page
1
2 3 4 5
11