Questions tagged [arguments]
An argument is usually defined as the actual value passed to a function, procedure, or command line program.
27 questions with no upvoted or accepted answers
3
votes
1
answer
1k
views
Bash completion - How to get filename completion for suboptions
I have a function which can take main arguments and then sub-arguments. Some of these sub-arguments are filenames. The current completion code I have is as follows.
_scm() {
local cur prev opts
...
2
votes
0
answers
84
views
In the context of {ARG_MAX}, how robust is `find . -exec sh -c 'exec tool "$@" extra-arg' find-sh {} +`?
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 ...
2
votes
2
answers
238
views
Determining name of the variable passed to function
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-...
2
votes
1
answer
4k
views
Run executable on background detached from terminal but with arguments
I can run an executable in the background and detach it from the terminal with these commands:
$ nohup ./executable &
or
$ ./executable &
$ disown
But none work if I send arguments to the ...
2
votes
1
answer
740
views
How to get clicked-on filename as argument of shell script triggered by this mouse-click
If, in Ubuntu's Nautilus, I click a midi-file, a window opens to specify an application for processing the file. Another option is a "user generated command" (UGC). (Let me choose Ubuntu, Nautilus, ...
2
votes
0
answers
1k
views
Mounting root filesystem while booting through network
I have two systems, let say one is the server and the other is the client.
I want to load kernel image from the server to the client through the network.
I used dhcp (isc-dhcp-server) and tftp (...
1
vote
1
answer
257
views
How to pass URL string in .desktop file in quotes
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 ...
1
vote
1
answer
240
views
How Can I Add Short Arguments to a Shell Script
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|--...
1
vote
0
answers
482
views
Capture arguments after PIPE in a bash script as string
I am writing a simple script (well, I thought it would be simple) to gather and log a 'reason' for using sudo. That part is working pretty straightforward based on another article I found (https://...
1
vote
0
answers
1k
views
Bash script that accepts options given after arguments in command line
I have a bash script that accepts a number of optional flags and two required arguments. Currently, if the command line call is ~/script.sh -a -b arg1 arg2 it works just fine, but if the call is ~/...
1
vote
0
answers
437
views
LFTP script file arguments
I've got an issue while using LFTP with some script files.
lftp -f download.lftp
the script looks something like that for now:
open -u someurl
mirror -i "somefile*.zip" --only-missing
...
somehow ...
1
vote
1
answer
820
views
Using input from two different files in a for loop
I have a list of files that I want to search across a list of database tables:
[root@host hs]# head -n 3 tables
rec_playinth120116
rec_playinth120216
rec_playinth120316
[root@host hs]# head -n 3 ...
1
vote
0
answers
393
views
Use a bash array as a place-in argument list (with Midnight Commander)
I'm having a little bit of trouble figuring out how I can use a bash array for an argument list. so far, the below code does not work.
The %s below is Midnight Commander specific.
F=(%s); for i in "$...
1
vote
2
answers
333
views
Default function arguments (manually emitting bash psuedo-signals)
I'm looking for a solution that will automatically allow me to call a function with specific parameters in a certain situation.
Here is the specific scenario:
When an error occurs, I can set up my ...
0
votes
1
answer
401
views
/bin/sh string variable as multiple argument
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="-...