Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Posts tagged shell-scripting

This tag doesn't have any usage information yet.

This tag doesn't have a detailed wiki yet.

71%
+3 −0
Q&A how to use %F in a file URI in a .desktop file

I'm trying to create a .desktop file which opens a file, either inside a Vim server named "VIM" if it exists, or otherwise using the normal Vim .desktop file. This is what I have so far: [Desktop...

1 answer  ·  posted 6mo ago by Trevor‭  ·  edited 2mo ago by Michael‭

Question shell-scripting gtk desktop xdg uri
71%
+3 −0
Q&A What does ${2-} mean in bash?

I came across this in a bash script: excludes+=("${2-}") What is the meaning of ${2-}?

1 answer  ·  posted 7mo ago by nogjam‭  ·  last activity 7mo ago by nogjam‭

Question bash shell-scripting options
75%
+4 −0
Q&A Is it a bad idea to pipe a script from curl to your shell?

Online, I often see someone tell people to run a command like /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" (example from https://brew.sh/). The g...

2 answers  ·  posted 10mo ago by matthewsnyder‭  ·  last activity 10mo ago by Stephen Kitt‭

Question security shell-scripting best-practices
50%
+0 −0
Q&A How to perform a zuluCrypt "Create Encrypted Container in Hard Drive" but as a Linux command line?

I have long been in the process of converting my manual steps to create a new backup disks into an automated script. The only part I have left is the initial "creation" of the disk, meaning whateve...

0 answers  ·  posted 12mo ago by [email protected]

Question scripting linux shell-scripting
71%
+3 −0
Q&A How to invert command exit code?

How to apply a logical not to a shell command, e.g. in a Bash script? So if the command exited with 0 (success) I would like it to be changed to a non-zero value, and if it exited with a non-zero ...

1 answer  ·  posted 1y ago by Iizuki‭  ·  last activity 1y ago by Quasímodo‭

Question shell shell-scripting
75%
+4 −0
Q&A How to run a command on a list of files?

Suppose I have a list of files on standard input. These may be the output of find, cat filelist.txt or something else. How can I run a command on each file in turn?

3 answers  ·  posted 2y ago by matthewsnyder‭  ·  last activity 1y ago by Quasímodo‭

Question shell-scripting
60%
+1 −0
Q&A How to use the gitignore file without git(1).

How can a file list be manually filtered with a gitignore file. I want to do the equivalent of git ls-files, but it should work even if I remove .git, so I can't use git(1). Currently, I'm doing ...

1 answer  ·  posted 1y ago by alx‭  ·  last activity 1y ago by r~~‭

Question shell-scripting find git
66%
+2 −0
Q&A Run pipeline in the background from git hook

I'm trying to run a pipeline to update a PDF after every push to the 'main' branch. I want it to be atomic, so it doesn't touch the existing PDF until it has finished, so I need to use sponge(1) (...

1 answer  ·  posted 1y ago by alx‭  ·  last activity 1y ago by alx‭

Question shell-scripting git
66%
+2 −0
Q&A Alternating 2 keyboard layouts with Key Combination

Sorry it was a typo, _ instead of -, that caused the problem. I want to have a key combination to alter the keymaps. It worked with one for us and one for hu, but now I want to use one key combina...

1 answer  ·  posted 1y ago by Arpad Horvath‭  ·  edited 1y ago by Arpad Horvath‭

Question shell-scripting gnome
66%
+2 −0
Q&A Higher-order functions in Bash?

Say I have some Bash function my-func, that expects a filename and does some processing on the corresponding file. For demonstration purposes, my-func() { cat "$1"; } If I want to apply that fu...

1 answer  ·  posted 1y ago by Karl Knechtel‭  ·  last activity 1y ago by Kamil Maciorowski‭

Question shell-scripting bash-function
57%
+2 −1
Q&A How to automatically change to the first matching directory using fuzzy search and cd?

I want the cd command to automatically change to the first directory that matches a fuzzy search, without prompting me to select between multiple options. This is what I've tried: cd() { loc...

1 answer  ·  posted 2y ago by ShadowsRanger‭  ·  last activity 2y ago by jimbobmcgee‭

Question shell-scripting cd fzf
60%
+1 −0
Q&A When a command takes filenames as argument, how can I avoid creating temporary files?

Suppose I have a command that takes filenames as arguments, like: diff foo.txt bar.txt What if instead of actual files, I want to use the results of a command in each? I can use temporary files: ...

2 answers  ·  posted 2y ago by matthewsnyder‭  ·  last activity 2y ago by Kamil Maciorowski‭

Question shell-scripting
80%
+6 −0
Q&A A shell script that can run under different shells

I have a shell script with a syntax compatible to both bash and zsh, except for a section that has zsh specific syntax that throws syntax errors if sourced from bash. Is there an easy way to escap...

2 answers  ·  posted 3y ago by 4015.alt‭  ·  last activity 3y ago by mjy‭

Question shell bash shell-scripting zsh
86%
+11 −0
Q&A In a bash shell script, how to filter the command line argument list to unique entries only, for processing each?

I have a handful of shell scripts that accept any number of command line arguments, then do some relatively expensive processing based on each command line argument in turn. The general format for ...

3 answers  ·  posted 3y ago by Canina‭  ·  last activity 3y ago by Quasímodo‭

Question bash shell-scripting