Skip to main content

Questions tagged [arguments]

An argument is usually defined as the actual value passed to a function, procedure, or command line program.

Filter by
Sorted by
Tagged with
3 votes
3 answers
903 views

The following script is supposed to check $1 and see if it is a specific value. It only works when one Bash [[... =~ ...]] regex check is passed in an if statement. The error is: When more than one ...
EmberNeurosis's user avatar
1 vote
4 answers
207 views

So I've ran into a bit of a wall, I have an option in my script that calls a function which allows me to specify a file/directory and then I want to parse that output into a menu tool (using dmenu in ...
hollowillow's user avatar
5 votes
4 answers
965 views

I'm trying to build a wrapper to execute a tool multiple times, then concatenate some of the results. I'd like to pass two sets of files to my wrapper script, then run the tool for each pair of files. ...
Whitehot's user avatar
  • 245
2 votes
0 answers
60 views

Suppose I want to do this: find . -exec tool {} extra-arg + It doesn't work and I know why: -exec … {} + does not allow extra-arg(s) between {} and +. So be it. It seems I can inject the extra-arg by ...
Kamil Maciorowski's user avatar
0 votes
1 answer
63 views

I want to list all the directories in present directory and pass those directories as a argument to another find command The below example will explain it correctly. $ find . -maxdepth 1 -type d . ./...
user27072144's user avatar
0 votes
1 answer
185 views

My small POSIX shell scripts do not usually take any arguments, so this is kind of new to me... The minimal snippet would probably look like this: # default for hotkey variable on top of script is set ...
Vlastimil Burián's user avatar
0 votes
1 answer
73 views

I have a script with this usage: myscript [options] positional-args... -- [fwd-params] Because [options] can have long, or short variants, I like using getopt. But I'm having troubles. I use getopt ...
Stewart's user avatar
  • 16.1k
3 votes
1 answer
648 views

I wrote a script that needs to call a command and pass on arguments. My script has its own parameters but some need to be passed through. This fails when arguments to my script have spaces in them. ...
Ned64's user avatar
  • 9,296
0 votes
2 answers
157 views

I have a program that tries to trigger a screenlock using the following commands: xdg-screensaver lock xscreensaver -lock cinnamon-screensaver-command --lock The problem is that I'm using ...
guttermonk's user avatar
2 votes
2 answers
701 views

To check if $i equals any command line argument (in a Bash script), I use if [[ " $@ " =~ " $i " ]] Is there a better way? I mean, a way that is more recommendable, more general, ...
Convexity's user avatar
  • 121
1 vote
1 answer
462 views

I'm using parameter substitution with an error message, such as ${var1:?'some message'}. I've incorporated a multi-line error message. Presently, it only functions properly when enclosed within single ...
programmer Erfan's user avatar
1 vote
2 answers
220 views

Is there a way to hide a single argument passed into the terminal, but still pass the argument to the command? This question addresses the problem of passing a plain-text password through the shell. ...
Jesse's user avatar
  • 355
2 votes
1 answer
277 views

I am working on a a script that need to take two script arguments and use them as variables in the script. I couldn't get this working and unable to find out what I am doing wrong. I see the issue is ...
MO12's user avatar
  • 409
0 votes
2 answers
317 views

I have a python program that requires 2 arguments input-file and output-file. It reads input-file and creates a copy of that file with some modifications in the output-file. I created a text file with ...
Data Engineer's user avatar
2 votes
4 answers
3k views

I know many have asked similar questions, but I can't make it work. I have a file called Dependencies: Accounts Aggregates Blog Configuration Contacts Contents DataTypes Forms Geo Globalization Media ...
Saeed Neamati's user avatar
1 vote
1 answer
167 views

I am using arch and bash. Everything is up to date. I have this command which works just fine yad \ --timeout=2 \ --undecorated \ --posx=1200 --posy=633 \ --title=" " \ --window-icon='/home/$...
Kes's user avatar
  • 909
1 vote
1 answer
897 views

things I tried in my script run.sh: mvn exec:java -Dexec.mainClass=my.App -Dexec.args="$@" mvn exec:java -Dexec.mainClass=my.App -Dexec.args=$@ when I call the script like: ./run.sh arg1 ...
morpheus's user avatar
  • 135
0 votes
1 answer
880 views

I am pretty green when it comes to bash scripts and completely new to command line functionality in bash. I tried my hand at a script which is supposed to be useable both with command line arguments ...
J.Doe's user avatar
  • 103
8 votes
1 answer
1k views

I often find myself writing shell functions or shell scripts that are meant to be wrappers around other commands. It is also frequent that I want such a wrapper to support a few flags/options. The ...
kjo's user avatar
  • 16.4k
0 votes
1 answer
104 views

Following http://superuser.com/questions/1780479 and http://superuser.com/questions/1777606, we issue the following script to compare times of the same–full-path symlinks under directories $1 and $2: #...
user avatar
0 votes
3 answers
987 views

I'm writing a bash script where I want to grep the name of a process. This name is the argument when the script is executed. Normally I can do this ps -ef | grep [w]ord to get the correct processes. ...
user3045272's user avatar
1 vote
1 answer
555 views

I have a script that connects to Openshift and launches a series of commands on PODs. Since I am working with multiple PaaS, I need to launch the script on each of them with a different connection ...
BNT's user avatar
  • 13
10 votes
1 answer
2k views

I've come across this piece of code from here: #!/bin/bash # ... if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then echo "Usage..." exit fi I understand what this does is print the ...
xtropicalsoothing's user avatar
0 votes
1 answer
32 views

With the following function I want to be able to call it with nico-usage or with a numeric value to print a different string. Con this be cleaned up or made easier. nico-usage () { local ...
Vera's user avatar
  • 1,373
0 votes
2 answers
1k views

For an application, I need to open a new terminal window and later execute some commands in that. I tried the command gnome-terminal And it works properly, it open a new terminal, but when i want to ...
Pinkurauchin's user avatar
0 votes
3 answers
2k views

I've tried a few solutions posted here, but to no avail. I'm hoping it's something silly and obvious that I've missed, that you can spot easily, and I can facepalm myself. I have a bash script ...
funguy's user avatar
  • 3
0 votes
1 answer
384 views

I have a docker container setting an ARG to CMAKE_ARGS=-DWITH_CPU=arm -DCMAKE_C_FLAGS="-march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -mvectorize-with-neon-quad" -DCMAKE_CXX_FLAGS="-...
Matt H.'s user avatar
0 votes
1 answer
156 views

I'm trying to write a completion for a command (call it gs) that takes an SSH hostname as its first argument, and an arbitrary string as the second argument. I've stolen this from the default SSH ...
Arno's user avatar
  • 103
10 votes
1 answer
1k views

SHORT VERSION (TL;DR) I have 2 small one-line files, seemingly identical : $ cat f1 f2 ./cconv.sh 100 EUR USD ./cconv.sh 100 EUR USD But they are not, there is a 1 byte difference in size : $ ls -l ...
ChennyStar's user avatar
  • 2,019
3 votes
4 answers
1k views

I am having trouble trying to describe my issue. Please bear with me. I have a script that calls a command. I need to optionally include an extra argument in the command line depending on the input ...
Brendan's user avatar
  • 29
1 vote
1 answer
237 views

I installed WhatsApp Desktop via Wine and I am trying to associate whatsapp:// links with it. Executing the following via command line works and starts a chat with the phone number +1234567890: env ...
Mike's user avatar
  • 459
2 votes
2 answers
210 views

If I pass variable as a positional argument to a function, is it possible to determine the name of the variable used from inside the function, or I can only access its value? I have a function envir-...
Vera's user avatar
  • 1,373
0 votes
1 answer
479 views

I have a collection of bash functions that include a verbosity level option. According to the set value, different levels of outputs are generated. The verbosity is local to each function. But I ...
Vera's user avatar
  • 1,373
3 votes
1 answer
7k views

for instance, gcc accepts the input file without any flag and the output file with the -o flag in: gcc input.c -o output.out or gcc -o output.out input.c I am creating a random password generator bash ...
Shriram's user avatar
  • 226
-1 votes
1 answer
118 views

I want to apply Gnu enscript on a large collection of files (every file tracked by git in the current Linux kernel). I have just for the hell of it. However, I've tried various things to pass those ...
Leland Kilborn's user avatar
0 votes
2 answers
141 views

Sorry if the title is bad (it is already the best one I can think of). Anyway, here is the line of code: printf "%s\n" "$(echo a b "c d") Simple code. Of course, I will ...
sudoer's user avatar
  • 65
2 votes
1 answer
1k views

According to the manual man systemd.service using the prefix @ says this: If the executable path is prefixed with "@", the second specified token will be passed as "argv[0]" to ...
Edgar Magallon's user avatar
2 votes
3 answers
336 views

I'm exploring the notion of having a shell script input and output two dimensional structures of strings, with the limitation that the strings do not contain newlines. They can contain spaces. The way ...
Steven Lu's user avatar
  • 2,432
0 votes
0 answers
8 views

I am trying to pass a regex pattern as an argument to my script as follows: bash script.sh '[a-z]*[0-9]*' in my script I am assigning it to a variable FIRST_ARG=$1 using echo $FIRST_ARG results in ...
Yoh's user avatar
  • 1
1 vote
2 answers
526 views

I have the following command in my Makefile parallel \ --eta \ --bar \ --joblog mnist/embedder.joblog \ pipenv run python3 \ -m mnist.train_embedder \ --...
nalzok's user avatar
  • 441
1 vote
2 answers
515 views

I have to check if particular argument lets say 'java8' is present in my shell arguments to script and if it is present remove it . Also I want it to be stored in some other variable , but want it to ...
user3118280's user avatar
1 vote
1 answer
202 views

To add options, I have the following in one of my scripts: parse_opts() { while [ $# -gt 0 ]; do case "$1" in -h|--help) help=1 shift ;; -r|--...
Amarakon's user avatar
  • 373
2 votes
3 answers
391 views

Although there are many similar questions, I cannot find one that directly answers my question. I understand the basics of OS memory management, processes, communication between processes, etc. ...
user2514157's user avatar
0 votes
2 answers
171 views

I'm trying to create a function that executes the following composer config repositories.foo '{"type": "path", "url": "/b/foo-bundle"}' I'm starting with lb() { ...
Tac Tacelosky's user avatar
1 vote
1 answer
4k views

I am have a wrapper run_sas.sh around a command sas that runs SAS code in batch. A typical call looks like this ./run_sas.sh -sysin /my_code/my_program.sas -log /my_log_folder/my_program.log run_sas....
Dirk Horsten's user avatar
0 votes
1 answer
439 views

I'm using this method to open a Gnome terminal window and run command(s) — in this case, to send me simple notification messages (will be scheduled via at): #!/bin/sh gnome-terminal -- /bin/sh -c '...
user598527's user avatar
1 vote
2 answers
189 views

For example Postgres process command-lines are like postgres 794 1 0 Nov06 ? 00:00:03 /usr/pgsql-9.3/bin/postgres -D /var/lib/pgsql/9.3/data -p 5432 postgres 857 794 0 Nov06 ? ...
Damn Vegetables's user avatar
0 votes
0 answers
333 views

How can I modify this script so that I can add multiple users by providing arguments (usernames) in the command line instead? I know at the very least I need to remove the read options. I don't want ...
bossu's user avatar
  • 1
0 votes
1 answer
826 views

How can I get the position of an argument by using its value? For example: myScript.sh hello world echo "$1" hello How can I get the position of 'hello', which is 1 in this case?
Lite Riyusaki's user avatar
0 votes
1 answer
69 views

While providing external parameter values should have before and after hyphen. If hyphen is not there it should reflect the error stating that the hyphen should be needed before and after the text. ...
Gyari's user avatar
  • 15

1
2 3 4 5
11