New answers tagged shell
1
vote
Terminal is not fully functional warning with less but not with more (which is also less)
The same program can behave differently if it is being run with different parameters: in your first command it receives argv[] = {"less", NULL} as the command-line argument array, while the ...
2
votes
How do I delete every ocurrence of a word that is followed by another, without altering the whitespace?
With anything which supports perl-compatible regular expressions (PCRE), you can use a positive lookahead:
perl -pe 's/foo(?=.*bar)//' < txt
(?=) is a "zero-width positive lookahead assertion&...
3
votes
How do I delete every ocurrence of a word that is followed by another, without altering the whitespace?
OK, I found out how to do this. The command to do this with sed would be:
sed -i -E 's/foo([[:blank:]]*)bar/\1bar/' file
0
votes
Shell unbuffering for CygWin: is it possible?
Use stdbuf. It is on cygwin in the coreutils package.
2
votes
Variables not being set in Makefile
You need to remember that the "makefile" part of make, is separate from the "shell" part.
Once you're inside the recipe for the makefile it's all shell commands. That means you ...
1
vote
Accepted
Unix cat and zip together
From
zip(1) - Linux man page :
zip also accepts a single dash ("-") as the name of a file to be
compressed, in which case it will read the file from standard input,
allowing zip to take ...
0
votes
Unix cat and zip together
This probably isn't what you really want but you can do this.
mkfifo zip.pipe # create fifo
cat File2022*.txt > zip.pipe & # pipe data to fifo, in background
zip --fifo ...
1
vote
Accepted
Running shell Script via Crontab
Use > cron.log 2>&1 to have the cronjob write its output to a file, so that you could see the error messages it produces. (Some cron daemons automatically write the output to syslog when ...
1
vote
Accepted
Change the default location of zsh completion cache files for macOS
Update and fix.
I've updated my code to the following to fix the issue of two dump files being created.
ZSH_COMPDUMP="$HOME/.cache/zsh/zcompcache"
# Create the parent directory if it doesn'...
0
votes
How do I automate borg backup?
borgmatic was created for exactly this purpose and is a wrapper around brog. Create a .yaml config file, and then run borgmatic. Follow this cron guide and you're good to go.
3
votes
Accepted
How to split a string (of arguments) in fish?
Another way to do it would be:
echo "--r -run" | string split " "
So piping the string into that command.
3
votes
How to split a string (of arguments) in fish?
I got it working,
chatGPT answer:
By using -- after the " " delimiter in the string split command, we ensure
that the shell treats everything after -- as a regular argument and does not
...
0
votes
Cannot open Jupyter Notebook in the new zsh shell in macOS
The issue is to do with the '.bash_profile' file not being recognised by Zsh. Instead Zsh needs a '.zshrc' file. To fix simply follow these steps:
Open Finder and navigate to /Users/{YourUser}/
Press ...
0
votes
Accepted
ProxyJump not running ForceCommand defined in sshd_config
ProxyJump does not run a ForceCommand because it does not run any command at all – it does not open any interactive shell session, only a TCP tunnel (similar to the -L or -W options).
The only thing ...
1
vote
How can I kill Firefox by console?
Try:
$ kill $(ps -x | grep firefox | awk '{print $1}')
This command kills all firefox instances. From this website: link
0
votes
Accepted
zsh completion ( compctl ) does not trig for command names containing dashes
Got it confirmed in the zsh-workers@zsh.org mailing-list that this is a bug and got a suggested patch:
--- zsh-5.9.orig/Src/Zle/zle_tricky.c
+++ zsh-5.9/Src/Zle/zle_tricky.c
@@ -1315,6 +1315,8 @@ ...
0
votes
tee for Windows?
Native port of tee for Windows also exists, for example:
https://github.com/dEajL3kA/tee-win32/tree/master#tee-for-windows
Top 50 recent answers are included
Related Tags
shell × 3993linux × 1629
bash × 1531
command-line × 526
unix × 421
macos × 292
terminal × 288
zsh × 271
shell-script × 262
windows × 220
script × 217
ssh × 203
ubuntu × 191
bash-scripting × 92
environment-variables × 85
windows-7 × 69
fish × 69
sed × 64
find × 62
mac × 59
vim × 59
cygwin × 59
awk × 57
windows-10 × 52
python × 50