Skip to main content

Questions tagged [shell-script]

Questions about shell scripts, executable files that are interpreted by a shell (bash, zsh, etc.). Check scripts with https://shellcheck.net before posting.

1 vote
2 answers
85 views

I'm writing a bash script that archives logs from a folder where various servers dump their logs. From there, it moves them to one of three OneDrive mounts that are mounted with rclone (which I think ...
user1311554's user avatar
0 votes
2 answers
80 views

I'm writing a shell script that's aimed to be as portable and POSIX-compatible as possible, so usage of bash-only commands or high-level input libraries is undesirable. I'm looking for a way to read a ...
carbon-starlight's user avatar
1 vote
1 answer
114 views

I know and understand that scripts run through whatever I provide in the shebang at the top of the file. E.g., #!/usr/bin/env bash And that the file extension is entirely irrelevant. But that isn't ...
AbdelRahman's user avatar
1 vote
2 answers
143 views

I have a closed-source executable (self-hosted Azure DevOps agent) that starts many processes. Among them is pytest. For debugging, I want to attach strace to the pytest process started by that ...
Mo_'s user avatar
  • 279
0 votes
2 answers
82 views

Hello I'm wondering how it is possible to add a final command that is executed as first boot once the system is ready. Some of you have an example? Just for a test I would like to do something simple ...
user3450548's user avatar
  • 3,234
1 vote
1 answer
70 views

I need to download many archives and I want a way to process them one after another. I have a download program that reads files from an input folder and downloads archives from the internet into my ...
Banana's user avatar
  • 337
0 votes
0 answers
112 views

I have a keepassXC password store that contains both the SSH private key and its password. In order to import it to ssh-agent in a headless setup, keepassxc-cli needs to be used. To extract the key, ...
basher's user avatar
  • 105
-4 votes
4 answers
213 views

I'm working on the following pipeline (codeshare.io/243VJE): #!/bin/bash #SBATCH --nodes=1 --ntasks=1 --cpus-per-task=10 #SBATCH --time=2-00:00:00 #SBATCH --mem=40gb # #SBATCH --job-name=pan_pca #...
Matteo's user avatar
  • 387
5 votes
3 answers
1k views

I am using this code to parse the first argument passed to my script. It error handles and it works just the way I want it: if [ -z "$action" ]; then printf "[${c_RED}ERROR${c_RESET}...
EmberNeurosis's user avatar
2 votes
1 answer
242 views

Just in theory: is it possible to replace the domain string in the compiled binary file with an IP address by editing a binary file in place with sed? (IP address belongs to a different domain, but ...
fxgreen's user avatar
  • 143
1 vote
2 answers
103 views

Here is a sample directory tree as it would appear if it were sorted in character code order (i.e., directories are not listed first): ${PREFIX}/ .bashrc .include.sh.d/ common.sh ...
Melab's user avatar
  • 4,530
11 votes
1 answer
1k views

The test [[ -n $1 ]] yields True if the length of string is non-zero. But I've seen elsewhere and have tried using just [[ $1 ]] without the primary -n and it seems to have the same effect. Is there ...
CertainPensioner's user avatar
1 vote
1 answer
99 views

Suppose we have the file ./testing with contents #!/bin/bash # Flags # Source: https://stackoverflow.com/a/7948533/31298396 TEMP=$(getopt -o ''\ --long first,second \ -...
Grass's user avatar
  • 145
2 votes
1 answer
122 views

Using https://stackoverflow.com/a/7948533/31298396, we can implement flags for a script testing as follows: #!/bin/bash # Flags # Source: https://stackoverflow.com/a/7948533/31298396 TEMP=$(getopt ...
Grass's user avatar
  • 145
0 votes
4 answers
152 views

I would like to mount a partition of an external hard drive from a script using udisksctl mount --block-device /dev/sda1 and in the end of the script I would like to unmount it. However, it may ...
Alexey's user avatar
  • 2,390

15 30 50 per page
1
2 3 4 5
1119