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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
21 views

Double backslash disappears when printed in a loop

I have a script that joins together various lists of data fields which then needs to have a few more columns added. The file generated looks like this: $ cat compiled.csv "name":"...
vxla's user avatar
  • 11
0 votes
0 answers
5 views

"i3 exec" Not Working When Used With Xbindkeys Shortcut

I am making a "dmenu" shell script that will read a list of my VPN connetions and pipe them through dmenu. After the user selects the appropriate entry we call "nmcli". Bellow is ...
sashok_bg's user avatar
  • 111
0 votes
2 answers
79 views

Where do I find documentation for the output of ls -l?

There have been multiple questions asked about this, like Understanding ls output, What are columns in ls -la?, What does 'ls -la' do?, What do the fields in ls -al output mean?, etc.. I've also come ...
TrisT's user avatar
  • 111
0 votes
0 answers
21 views

How to automatically find, load and install wireless drivers in Linux?

When I install Debian Linux for my and my friend's laptops by using a net-install image(downloaded here), after I start the installation, it can usually automatically select a correct wireless network ...
kz25t's user avatar
  • 1
0 votes
1 answer
36 views

Connection test for multiple host

I have simple script which show me if connection between server is working, problem is that now I have multiple number of servers which I want to check and I don't want to check one by one, would be ...
majan's user avatar
  • 1
2 votes
1 answer
226 views

Don't truncate the COMMAND column in ps

I want to list process by their executable name, using the comm column. But it always gets truncated even when it's the last column: $ ps -C systemd-tty-ask-password-agent -o %cpu,%mem,comm %CPU %MEM ...
Kyle Richards's user avatar
0 votes
1 answer
26 views

What approach is recommended for defining important startup processes? (Independent of shell)

Note on formatting I've gone back and added bold text to my specific questions, because I feel the details have lead to the question getting lost. However, the details are kind of necessary to ...
Solonotix's user avatar
  • 101
1 vote
1 answer
50 views

Enabling command hashing in tcsh

It seems command hashing is disabled by default in our tcsh environment, and I'm not permitted to get it enabled across the board. Instead I'm looking to enable command hashing within individual ...
Maikol's user avatar
  • 155
-1 votes
1 answer
63 views

what is this message I get when I start bash?

When I start bash, it says ubuntu@ubuntu-Inspiron-3593:~$ and then just blinks. What is this? What does it mean? I am completely new to the bash shell and I don't know what I'm looking at, I don't ...
how to bash's user avatar
0 votes
0 answers
19 views

TightVNC Server Not Working at Debian 12 - Grey Screen Appears

I have installed TightVNC Server on my system using sudo apt-get install tightvncserver. However, when I try to connect to it, I only get a grey screen. Below are the contents of my ~/.vnc/xstartup ...
cod's user avatar
  • 1
0 votes
0 answers
25 views

Does bash explicitly allow commands like passwd, su, etc., to run in setuid while disabling other custom binaries? [duplicate]

I know that /bin/bash has certain built-in protections that prevent the abuse of the Set-UID mechanism. So if I create a custom binary and execute it, it won't run with SUID 0 (refer the below image). ...
yellowspectre's user avatar
4 votes
1 answer
119 views

POSIX Shell: `exec` with changed arg0

I want to exec a program and control it's arguments including arg0 and environment. Using C I could go for execve. Can I do this in POSIX shell?
Patrick Böker's user avatar
2 votes
2 answers
45 views

How to source environment variable in command line with && combiner?

For a NodeJs app, I wrote the following script to deploy the app: "scripts": { "deploy": "source private/create_env.sh && ./deploy.sh", } private/create_env.sh ...
Alphonsio's user avatar
1 vote
1 answer
55 views

Force tcsh to check whether command exist in the path before attempting to execute it

I've noticed that tcsh, regardless of whether "-f" flag is passed on the shebang line, will iterate through $PATH, and try to execute the command from that path until the command is found. ...
Maikol's user avatar
  • 155
-1 votes
0 answers
63 views

Executing Bash script: Chmod error - "No such file or directory" - File exists [closed]

I've seen variations on this question, but have not found anything directly addressing my issue. It seems very basic, but I'm stumped. I've successfully written and implemented few bash scripts, and ...
simplicio's user avatar
2 votes
1 answer
87 views

Shell detection of empty subshell

SC1143 suggests that commented parts of a wrapped shell command to be wrapped in a subshell. Is the Posix shell "smart enough" to not launch a subshell when it sees that it does nothing? ...
AvidSeeker's user avatar
0 votes
1 answer
35 views

How to generate a date in ISO 8601 format (UTC time) with an offset X days into the future? [duplicate]

When calling an API, I need to provide a start time and an end time in ISO 8601 format (UTC time). I want to call the API in a CRON job, so I can't manually create the date-time(s). How can I use the ...
Shuzheng's user avatar
  • 4,371
0 votes
2 answers
67 views

:q to quit from less and man. Are there other colon-commands in Bash/Zsh?

To quit from man or less, we use :q, like in Vim. But where can I read about this command and probably other similar commands (maybe :w, for example) in Bash or Zsh documentation? help q, help :q, ...
jsx97's user avatar
  • 179
6 votes
1 answer
219 views

Dynamics between parameter expansion and arithmetic expansion in echo $a$((a=2))$a

Shell is: GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) I'm considering the following command line: a=1; echo $a$((a=2))$a The output is: 122 I deduct that the expansion is processed in ...
yossi-matkal's user avatar
1 vote
1 answer
18 views

zsh completion for umount: limit completion to one argument

when I use zsh completion for the umount command: umount /mnt/t<TAB> it completes the mounted filesystem /mnt/tmp. But when I accidentally press tab too many times, it tries to be too helpful, ...
Martin Vegter's user avatar
0 votes
1 answer
25 views

How Can I Change The Backgound Color in Lynx From `lynx.cfg`?

I am using this script, from another stack extange post. It allows me to force Lynx to use the proper terminal colors. The issue is that the backgound color is incorrect, and it is reading the 7th ...
VehementHam's user avatar
0 votes
1 answer
41 views

Rsync throwing errors but files appear to be fine

I am doing a massive 200TB transfer with rsync. I used a shell script I found off the internet to spawn a few processes but here is the relevant rsync command itself: rsync --recursive \ ...
john cs's user avatar
  • 164
0 votes
0 answers
104 views

How to keep a shell alive after it gets started from inside a program?

I was not sure where to ask this question, since it is a mix of both programming and Linux, but hopefully this is the right place. I have written a simple program, which I'm buffer overflowing. I have ...
r3k0j's user avatar
  • 15
1 vote
1 answer
37 views

Possible reasons for the shell's "not found" response?

What are all the possible reasons that the shell would respond with "not found" when trying to run an executable? The executable definitely exists and has execute permission (chmod +x). ldd ...
Dane's user avatar
  • 13
1 vote
2 answers
83 views

Replace value in yaml file using yq

I am using yq version 4.34.1 in powershell. I try to replace the value of .spec.source.targetRevision in target.yaml with the newer value from a variable $newTargetRevision. So, what I am doing now is ...
Rexagon's user avatar
0 votes
0 answers
39 views

How to check how often a file is updated via terminal?

I have a file that is being updated via a script I do not have access. I am trying to see how often it gets updated. One thing that occurred to me was doing a: watch -n 0.1 "ls -la" The ...
Yi Qiang Ji's user avatar
0 votes
1 answer
28 views

Why does this script variable keep showing as "null"?

I have the following script: def String Service_version = sh "cd ./projects/onehome && pwd && cat package.json | grep version" echo "Service_Version_update: ...
Jenber Nurye's user avatar
0 votes
0 answers
36 views

Is it safe to redirect output of the awk command to the same file used for input? [duplicate]

In this comment, community member DannyDannyDanny asked if it is safe to redirect output of the awk command to the same file being used for input. No one answered that comment, so I would like to ...
End Anti-Semitic Hate's user avatar
0 votes
0 answers
27 views

Can I change default return action on an empty terminal prompt?

Basically, I'd love to be able to be able to configure my terminal to run a ls command when I don't put anything on a terminal prompt and I press enter. If return is pressed in the shell on an empty ...
nameisnorm's user avatar
1 vote
1 answer
44 views

Fish access non-aliased command from alias

How can I access the non-aliased version of a command from within the alias for that command? In bash, I can do something like alias ls='\ls -l' to access the non-aliased ls inside this alias for ls. ...
The Bic Pen's user avatar
1 vote
1 answer
168 views

Popup cannot be interacted with: "Daemons using outdated libraries" "Which services should be restarted?"

The pop-up "Daemons using outdated libraries" "Which services should be restarted?" breaks my scripts as it cannot be interacted with, requiring me to interrupt. It happens when I ...
BigMistake's user avatar
0 votes
1 answer
38 views

How do I set up a login shell with arguments?

I would like to add a user whose sole purpose is provide a "dashboard" for my machine (laptop), without letting them doing anything else (whether it's any useful is debatable, but it's ...
404 Name Not Found's user avatar
0 votes
1 answer
59 views

Permission denied error when starting terminal

I'm getting this error when I start my terminal: /home/USERNAME/.config/envman/PATH.env:2: permission denied: /home/USERNAME/.local/bin this is my .zshrc file: # Enable Powerlevel10k instant prompt. ...
Ilgar's user avatar
  • 3
1 vote
0 answers
41 views

Why am I using an interactive non login shell, but I can still access the environment variables defined in /etc/profile?

According to the bash manual,only login shell will load the /etc/profile file. When Bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first ...
hhx's user avatar
  • 11
0 votes
0 answers
18 views

Get fullname of downloaded Python wheel, without merely watching the filesystem

My script downloads a "continuum-transfunctioner" wheel from a pypi server as follows: python3 -m pip download continuum-transfunctioner -i https://pypi.acme.com:8080/simple --no-...
Olumide's user avatar
  • 177
0 votes
0 answers
35 views

Why does a program launched by echoing into sh persist after parent termination?

I was looking at dmenu_run, which is the default dmenu script to launch a program, and saw this part of it that intrigued me: [..other stuff..] | dmenu | sh & So I did some testing. Prerequisites ...
mutageneral's user avatar
4 votes
0 answers
69 views

Is there a test harness that can check how POSIX compliant a shell is?

Assuming I write a shell, is there some form of test harness that ensures that the shell is POSIX compliant (specifically /bin/sh without any of the bash extensions) in that it would run most ...
Archimedes Trajano's user avatar
2 votes
3 answers
78 views

Extract a string from a searched column index on the row below?

I'm trying to make a simple disk usage shell script (in dash), but unsure how to parse this string because I'm not familiar with AWK's syntax. I use this command: df -P -BG /, and, for example, it ...
mrjpaxton's user avatar
-1 votes
2 answers
96 views

Test for substring in posix shell .sh script (NOT bash)

I use an .sh script to read the installed firmware of a controller and to compare it with the available firmware (and update on the controller if needed). To make sure the readout works I want to test ...
Serakis's user avatar
1 vote
1 answer
64 views

How to display text for non-interactive login shell

What I need: I am trying to change /etc/bashrc in such a way that shell could display specific text when the following ssh command is entered ssh user@ip "whoami" But I don't understand ...
Judith5230's user avatar
0 votes
1 answer
81 views

How can root get access to SSH_TTY

I think that SSH_TTY is an environment variable set by ssh that holds the device node of the current virtual terminal; e.g. /dev/pts/0, /dev/pts/1 , etc. I know that when I'm logged in to an SSH ...
Seamus's user avatar
  • 2,894
0 votes
1 answer
73 views

LINENO and BASH_LINENO

So I'm not sure why this is.. I know ${LINENO} normally contains the line in the script, and BASH_LINENO goes based on input from BASH_SOURCE as an array $ (echo hi;declare -p LINENO BASH_LINENO;echo ...
linuxgeek's user avatar
2 votes
1 answer
79 views

zsh completion: complete from predefined list

My zsh script takes following arguments: ./script --connect server --foo 3 --bar 5 name --foo and --bar take integers, name is the only non-option argument, and --connect should complete from ...
Martin Vegter's user avatar
4 votes
2 answers
964 views

Does any implementation of `which` output "no" when executable cannot be found?

I am reading the source code of the Maven wrapper written for the Bourne shell. I came across these lines: if [ -z "$JAVA_HOME" ]; then javaExecutable="$(which javac)" if [ ...
Stefan van den Akker's user avatar
-1 votes
2 answers
89 views

When does the shell search PATH?

I am a bit confused about when PATH is searched. I had thought that PATH was only searched when a simple filename is given as the first token on a line, as in $ date A question I am solving however, ...
EE18's user avatar
  • 233
6 votes
1 answer
414 views

Order of shell expansions: command substitution versus arithmetic expansion

Consider the following snippet being entered at the command line in bash: $ echo $(( $(wc -l letter.txt | cut -c1-4)/66 + 1)) Supposing letter.txt exists and has 66*4 lines, then this puts the string ...
EE18's user avatar
  • 233
1 vote
2 answers
64 views

If my variable contains quoted globs and I expand it without using double quotes, why do the globs disappear?

I was trying to use unquoted strings expansions to pass two arguments to tar; the first is the command-line flag --exclude and the second contains a * character. In an attempt to avoid premature ...
hugomg's user avatar
  • 5,737
0 votes
1 answer
41 views

How does the Readline Library use the .inputrc file?

In his A Practical Guide to Linux, 4e, Sobell gives us the following snippet: $ cat ~/.inputrc set editing-mode vi $if mode=vi "\C-y": vi-next-word $else "\C-y": ...
EE18's user avatar
  • 233
1 vote
0 answers
38 views

Shell script looking for a missing module

I want to run a shell script on a compute cluster but I get an error because at some point it is looking for a module that does not exist since a major update on the cluster a few months ago. This ...
Seb's user avatar
  • 11
-1 votes
1 answer
70 views

As soon as I touch a new file, my ls command with grep stops working [duplicate]

I'm trying to find all the files in my home directory with a specific extension. If I only have one instance of the file extension, the ls command works perfectly fine, but as soon as I touch a new ...
Luna's user avatar
  • 1

1
2 3 4 5
242