New answers tagged

3

First, do not parse ls. There are many reliable ways of getting file names but ls is not one of them. The following uses the shell's globbing to generate file names and passes a nul-separated list of them to xargs which runs them through cat: printf '%s\0' * | xargs -0 cat I understand that the point of this was to demonstrate files->xargs. ...


3

There is no consistency in naming the use of option, argument and flags and there is no enforcing authority within the software development world to enforce usage. This happens for all wording: after 30+ years of using the word directory, I now have to deal with people using the world folder, having been confused with Microsofts new-speak. Things you put on ...


2

A flag is a type of option, an option of boolean type, and is always false by default (e.g. --verbose, --quiet, --all, --long, etc). An option tells the function how to act (e.g. -a, -l, --verbose, --output , -name , -c , etc), whist an arguments tells the function what to act on/from (e.g. *, file1, hostname, database).


-2

ls -ltr | cut -c54- change the column (54) so you only get the data you want.


2

The syntax ${VAR:-default} evaluates to the value of VAR or, if it is unset or null, it evaluates to the text after the hyphen (in this case, default). $2 is a positional parameter, so your statement is testing the value of the second argument, and if it is not set, using an empty value as a default. Why use an empty default, since that would have the same ...


2

Backquotes delimit a command substitution: the command inside the backquotes is executed, and its output is interpolated into the command line. (There are further complications if the backquotes are not inside double quotes, more on this later.) So what's happening is that git rev-list … is executed in the current directory, before RepoScan runs. It can't be ...



Top 50 recent answers are included