Questions tagged [options]
Passing options like -l or --word to commands, or parsing them in scripts.
338
questions
0
votes
1
answer
83
views
When and why was the single dash introduced for command line options?
Already in the 1980ies, ls -l did mostly what it does today. For a boolean option, in this case l, I hardly ever questioned why it is prefixed with a dash: without an indicator, ls l would mean "...
11
votes
1
answer
2k
views
Why does `nice` with a negative argument (e.g. `nice -15`) increment niceness?
My nice is from GNU coreutils 9.1. I observed that nice -15 is equivalent to nice -n 15:
nice # prints 0 for me, the base niceness is 0
nice -n 15 nice # prints 15, this is ...
0
votes
0
answers
46
views
How to gracefully handle differences in command options between different versions?
Inspired by What is the difference between “base64 -b0” in macOS versions prior to macOS 13 (Ventura) and “base64 -i” in macOS 13 (Ventura)?
Are there common ways to avoid the script breaking on a ...
0
votes
1
answer
47
views
What is the difference between quotes wrap around only the option value vs quotes wrap around the option name and option value?
What is the difference between
quotes wrap around only the option value
eg: grep --file="grep pattern file.txt" *
vs
quotes wrap around the option name and option value
eg: grep "--...
1
vote
1
answer
108
views
What are the possible objdump demangle styles?
The manpage for objdump states:
--demangle[=style]
...
The optional demangling style argument can be used to choose an appropriate demangling style for your compiler.
Nowhere does it mention ...
1
vote
1
answer
79
views
Could someone explain when I would use sync -d over sync with no options?
I'm looking at an online man page for the sync command and I can't quite figure out the intended use of the -d or --data option.
Is it faster? Does it have any noticeable effect? Or is it something ...
0
votes
1
answer
70
views
Duplicate boot params after grub2-mkconfig
I removed the flags 'quiet' , 'splash' , and added others in the file /etc/default/grub, applied them: grub2-mkconfig -o . After a reboot, the kernel boot flags began to double. With each 'grub2-...
8
votes
1
answer
881
views
Looking for a more permissive alternative to GNU getopt for wrapper script
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 ...
6
votes
1
answer
170
views
How can I force zsh to write automatically complete path to history?
Suppose I did some time ago cd /path/to/foo/bar and then evince file.pdf. Now if I want to open file.pdf again I have also to do both steps again (using history). However I would do it in a single ...
0
votes
3
answers
329
views
listing existing users sorted by date of creation using cut command
ASK: to use cut command to list all users to confirm a successful useradd.
ISSUE: The list was very long and I had to scroll through output to find user.
NEED: Sort by the date the user was created. ...
-1
votes
1
answer
315
views
How to check for passed options using getopts in a POSIX shell? (Report, count, and discard.)
How to check for passed options using getopts (man page) in a POSIX shell? (Report, count, and discard.)
My idea is this: Many of my scripts take no options (not even -h for help, I am transitioning ...
-1
votes
1
answer
55
views
Script is not activating the options
I'm making a script to open url by terminal and when typing:
#!/usr/bin/bash
## origin: https://www.vivaolinux.com.br/script/Abrir-arquivos-em-nova-aba-no-Firefox
##
### Se quizer que o novo link ...
1
vote
2
answers
979
views
rm command contradictory options -i and -f
I learned that -i option is interactive mode and -f option is force model in rm command.
When I tried both options
rm -if test.txt
it did not ask me and just deleted it which means -f option overrode ...
0
votes
2
answers
347
views
Error parsing arguments for options in script Unexpected option in Shell Script
I'm trying to parsearg arguments to pass options to the script.
but it is showing the following errors Unexpected option: -u in addition to looping below:
$ gitpratico -u "<usuario_github>&...
1
vote
1
answer
71
views
install --compare is said to, in some cases, not modify the destination at all - but in which cases?
The man page for install describes the --compare option like so:
-C, --compare
compare each pair of source and destination files, and
in some cases, do not modify ...