Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [shell]

The shell is Unix's command-line interface. You can type commands in a shell interactively, or write scripts to automate tasks. Use this tag for questions applying to /bin/sh and most compatible shells (ash, bash, ksh, zsh, …). For shell scripts with errors, please check them in http://shellcheck.net before posting here.

-1 votes
0 answers
21 views

What's the difference between "ps > log" and "log < ps" in GNU Bash shell? [duplicate]

Why is that in the command "log > ps" the shell considers "ps" as a file? Does these operators (> and <) behave differently in other shells aside GNU Bash?
Rafael's user avatar
  • 1
-1 votes
0 answers
18 views

Why "read var 1< file1" does not read from file in GNU Bash shell? And why "read var < file1" does? [duplicate]

If the number 1 means stdout, why I'm not reading the stdout from file in "1< file" ?
Rafael's user avatar
  • 1
3 votes
1 answer
136 views

How to overload / customize bash (or any other shell) commands handler?

When in bash some non existing command is run, corresponding error message appears: $ non-existent-command non-existent-command: command not found Is it possible to customize this behavior? I would ...
Anton Samokat's user avatar
2 votes
1 answer
38 views

What does POSIX's third exception to the application of `set -e` mean?

The POSIX shell standard gives three exceptions to the application of set -e: The failure of any individual command in a multi-command pipeline shall not cause the shell to exit. Only the failure of ...
emron's user avatar
  • 51
0 votes
0 answers
7 views

Autocomplection with description in zsh

General overview This question complete this other one. I try to set an autocomplete for --test parameter who should suggest a list of possible values (Here “foo” and “bar”). Until theire, it pretty ...
fauve's user avatar
  • 1,290
-1 votes
1 answer
34 views

Is the idea of having a login shell and a non-login shell merely a way of making user preferences? [duplicate]

Scouring the internet about the difference between a login shell and a non-login shell, it turns out that the ultimate difference is merely the files that are being sourced. A login shell sources some ...
JLC's user avatar
  • 317
3 votes
2 answers
344 views

"history" command ordered by most common

Can I get the output of history sorted in order of most-used? I know how to do it in a programming language, but not from the shell. In my case I'm on macOS with zsh. I know I could use uniq and sort ...
hippietrail's user avatar
0 votes
5 answers
108 views

What is the difference between using code $variable and ${variable}2?

What is the difference between using code $variable and ${variable}2 ? Example: file ='GLOBAL_AR_COLLECTOR_COMMENTS20240614ALYSSAB.TXT' prefix ='GLOBAL_AR_COLLECTOR_COMMENTS' In my shell script code ...
Celestica - Prabhahar Palanive's user avatar
3 votes
1 answer
446 views

What is the precedence of operators '=', '||'

In this command, if curl succeeds, then res will be set to the output of curl. It seems = has higher precedence than ||. res=$(curl -s "http://example.com")||true But || should have higher ...
lamplet's user avatar
  • 35
1 vote
1 answer
28 views

omz reload in zsh widget

I am using zsh+oh-my-zsh and I am using the following code to change .zshrc using a hotkey and I am trying to reload omz after the change: function f() { # ... update .zshrc here ... omz reload } ...
Udi's user avatar
  • 193
1 vote
1 answer
20 views

zsh autocompletion for parametre value

General overview Here is my auto complexion file: _triumphum_complete() { _arguments \ '(- 1 *)'{-h,--help}'[show help options]' \ '(- 1 *)--tui[Run the game selection interface]' \ '(- 1 *)'{-r,...
fauve's user avatar
  • 1,290
-6 votes
0 answers
48 views

What is the output of the following ROT13 transformation command? [closed]

The command I'm using is: echo "YRNEAVAT_YVAHK_SHAQNZRAGNYF" | tr '[A-Z]' '[N-ZA-M]' I'm having trouble figuring out the exact output of this command. Could someone explain the process and ...
Jack Harry's user avatar
7 votes
3 answers
675 views

Is there an equivalent of caniuse for commands on posix systems?

I'm thinking about using a callout to the jq command in a utility script I'm writing, rather than parsing JSON manually. In order to make the script as portable as possible, I want to know which ...
Viscountess of the Junkyard's user avatar
0 votes
1 answer
37 views

Get a list of all user's commands from a non-interactive shell

I am writing a script that would automatically suggest some new aliases/functions to be added to a user's shell config. Before doing that, however, I would like to make sure the aliases being ...
zoickx's user avatar
  • 51
-3 votes
1 answer
70 views

How to convert multiple columns to rows in shell (unpivoting)

I have a tab separated table with hundreds of columns and rows, like that: OTUId AC0184 AC0250 AC0257 AC0258 AC0262 AC0263 AC0289 AC0293 OTU549024624 51659 0 0 0 0 0 0 0 OTU565712448 108 0 0 0 0 0 0 0 ...
babinecha's user avatar

15 30 50 per page
1
2 3 4 5
810