shell

Fish access non-aliased command from alias

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. How can I do this in fish? Right now I’m using env …

Total answers: 1

Permission denied error when starting terminal

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. Should stay close to the top of ~/.zshrc. # Initialization code that may require console input (password prompts, [y/n] # confirmations, etc.) must go above this …

Total answers: 1

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

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 the response string for the substring "ERROR" …

Total answers: 2

LINENO and BASH_LINENO

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 -e "My LINENOtist${LINENO}nMy BASH_LINENOtist${BASH_LINENO[@]}") hi declare — LINENO="34" declare -a BASH_LINENO=() My LINENO is 34 My BASH_LINENO is …

Total answers: 1

zsh completion: complete from predefined list

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 predefinded list of servers. I am stuck at the –connect part, where I tried to define server list. _arguments …

Total answers: 1

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

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 [ -n "$javaExecutable" ] && ! [ "$(expr "$javaExecutable" : ‘([^ ]*)’)" = "no" …

Total answers: 2

When does the shell search PATH?

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, seems to suggest that PATH is also searched …

Total answers: 2

Order of shell expansions: command substitution versus arithmetic expansion

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 5 on the command line. Now what I cannot follow is …

Total answers: 1

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

As soon as I touch a new file, my ls command with grep stops working 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 file …

Total answers: 1

Does the shell creating a subshell require the () Groups command?

Does the shell creating a subshell require the () Groups command? In my book (Sobell’s A Practical Guide to Linux, 4e) it is written that You can use the parentheses control operator to group commands. When you use this technique, the shell creates a copy of itself, called a subshell, for each group. It treats …

Total answers: 2

Customized Linux systems cannot use crtl+c to terminate ping commands?

Customized Linux systems cannot use crtl+c to terminate ping commands? I customized the root file system using Busybox´╝î and its version is 1.36.1. I don’t know why my device cannot be terminated by ctrl+c when typing ping an IP on the monitor keyboard. However, when I connect to the device through SSH, the ping an …

Total answers: 1

How to create a new column and add a random identifier to it with miller

How to create a new column and add a random identifier to it with miller I want to add a column with a randomly created "case number" to my csv file. The first 2 letters of the casenumber must be any letter from A-Z in capitals. followed by 5 random numbers. input: COMPANY,NAME,STREET,ZIP,CITY,IBAN Test Ltd,John,Big …

Total answers: 5

rsync –recursive –ignore-existing: what (if any) additional flags are needed to resume/repair/overwrite any partially copied files?

rsync –recursive –ignore-existing: what (if any) additional flags are needed to resume/repair/overwrite any partially copied files? Assume an rsync –recursive –ignore-existing foo bar copy command was being run for a large directory tree named foo, but that that command got prematurely interrupted. For example, because of a sudden power failure on the target machine. Running …

Total answers: 1

How to properly escape shell commands in ExecStart?

How to properly escape shell commands in ExecStart? Running this: [Unit] Description=Save a screenshot Wants=screenshot.timer [Service] Type=oneshot ExecStart=/bin/sh -c ‘DISPLAY=:0 scrot /home/myuser/Pictures/Journal/$(date +"%s").png’ [Install] Results in: scrot: Saving to file /home/myuser/Pictures/Journal//usr/bin/zsh.png failed: No such file or directory Why? The same command, run in a shell, works: % /bin/sh -c ‘DISPLAY=:0 scrot /home/myuser/Pictures/Journal/$(date +"%s").png’ % echo …

Total answers: 1

start multiple terminal windows in a "process group" so that remaining processes can be killed, if any one of the processes terminates

start multiple terminal windows in a "process group" so that remaining processes can be killed, if any one of the processes terminates I have a script which starts 3 terminal emulator windows: #!/bin/sh terminator –role=’terminator-left’ 2>/dev/null & sleep 0.1 terminator –role=’terminator-center’ 2>/dev/null & sleep 0.1 terminator –role=’terminator-right’ 2>/dev/null & (I am using the –role option, …

Total answers: 3

How to make screen command use shell "bash" instead of shell "sh"?

How to make screen command use shell "bash" instead of shell "sh"? Realized that my bash script in development needs thourough testing from line 1, line by line Started mate-terminal session Split screen vertically, left side emacs editing bash script, right side watch command of said bash script, so that edits on the one side …

Total answers: 2

How to change directory in shell script running in zsh shell

How to change directory in shell script running in zsh shell I am working on a shell script (shell used, its version and OS are below). The script runs commands in a local git repository/directory with has several tags. The script outputs some string from greping files in a certain directory which is selected based …

Total answers: 2