The tag has no wiki summary.

learn more… | top users | synonyms

37
votes
7answers
6k views

How do I delete a file whose name begins with “-” (hyphen a.k.a. dash or minus)?

How do you remove a file whose filename begins with a dash (hyphen or minus) -? I'm ssh'd into a remote OSX server and I have this file in my directory: tohru:~ $ ls -l total 8 -rw-r--r-- 1 me ...
8
votes
4answers
4k views

How do I handle switches in a shell script?

Are there some built-in tools that will recognize -x and --xxxx as switches, and not arguments, or do you have to go through all the input variables, test for dashes, and then parse the arguments ...
15
votes
4answers
2k views

Single dashes `-` for single-character options, but double dashes `--` for words?

Where did the convention of using single dashes for letters and doubles dashes for words come from and why is continued to be used? For example if I type in ls --help, you see: -a, --all ...
2
votes
4answers
102 views

Parsing process command-line arguments from pargs in a shell script

I get list of PIDs in my bash scripts (Java processes) and have to analyze their command-line arguments to determine which instance of server each PID corresponds to. At the moment I do it that way ...
16
votes
2answers
9k views

tar cvf or tar -cvf ?

I have learned to use tar without '-' for options, like tar cvfz dir.tar.gz Directory/ but I recently came accross the slightly different tar -czvf syntax (I think the 'f' must be the last option in ...
5
votes
2answers
74 views

Handling an option-like filename in the shell [duplicate]

Possible Duplicate: How do I delete a file whose name begins with "--"? Due to mismatched switches when I was trying to run a command, I have a log file named -w in a directory. I ...
3
votes
3answers
186 views

What is a “non-option argument”?

I am trying to understand info who but completly fail at the term »non-option argument«. Can someone please explain this term to me in simple words or an example? UPDATE: from ' info who' ...
5
votes
1answer
579 views

In the usage string of my custom shell script, shall I also display --help and --version?

I'm currently developing a shell script, called up, which shows a usage string on the commandline when called with --help. The output looks like this: $ up --help usage: up [-n ...
4
votes
3answers
231 views

convert soft- to hardlinks with cp

The cp command's infopage offers on the option --preserve= the following: links Preserve in the destination files any links between corresponding source files. Note that with -L' ...
2
votes
1answer
382 views

What is the `less` command line option to page to the next file at the end of the current one?

I'm sure there used to be an option in less which allowed you to page onto the next file after you reached the end of the current file, so you could just keep *space*ing through a bunch of short files ...