All Questions
Tagged with bash shell-script
508
questions
0
votes
2
answers
105
views
bash + how to insert date before line
lets say I want to pipe the date output in the beggining of some text
for example
echo "this line is test line" | date
and expected output should be
Wed May 22 14:55:10 UTC 2024 this line ...
0
votes
1
answer
80
views
Why do string variables in a bash script behave differently when echo'ed than they do when passed to an executable?
I have the following script:
#!/bin/bash
KID3=$(command -v kid3-cli)
ARG1="-c 'get'"
file="'1-01 - Johann Strauss - __Waldmeister___ Ouverture.flac'"
echo Command:
echo "$...
0
votes
0
answers
246
views
how to use curl for single sign-on website or page
I've already written a shell script but it's not working. I'm getting an empty response whereas it should first return a token and also it should login then register the API.
That's the task which my ...
0
votes
1
answer
35
views
shell helper function wrapping `find` and ignoring some dirs
I have a bunch of scripts which follow the pattern of:
find files which match a pattern
do something
The problem is that there are several "hazard" directories which are large and slow, ...
1
vote
2
answers
175
views
Why does zip --exclude only exclude files in the folder but not the folder itself?
I have the following command run in the bash shell which excludes the files in the folder scripts/. I tried the answer in Zip command for excluding directories and files but unfortunately it did not ...
0
votes
1
answer
153
views
How to convert code from test format to if fi format?
I have code that opens a bash file in a terminal for entering the sudo password:
test "$IN_TERM" || {
export IN_TERM=1
konsole -e "$0"
exit 0
} && true
I need ...
3
votes
0
answers
241
views
Is there a good way to write a shell script compatible with both bash and zsh that addresses array elements?
The fact that bash is 0-indexed and zsh is 1-indexed can cause problems. For example the following will work as intended with bash, but not zsh (PS I am aware that I don't NEED to use an array for ...
0
votes
1
answer
89
views
How deep is too deep for Nested Folders in a Bash program?
I am somewhat new to Bash and am writing a program to install .NET SDK and Runtime on each of the available Linux distros.
The problem I am having is that I am trying to source functions from two ...
0
votes
1
answer
73
views
zsh on MacOS catalina 10.15.17
I'm having a little trouble putting this all together...
I want to make a simple shell script to organize and sort around 60 GB worth of music and movie files that are spread out over 3 or for 4 ...
0
votes
1
answer
63
views
Complex find statement
Have a script that I use to purge old backup directories. All the directories are named YYYY-MM-DD. The backup directories have links in them as the backups are incremental using the rsync --link-dest....
1
vote
1
answer
486
views
Maintain a fixed-size-queue of nohup jobs
Suppose I would like to run multiple nohup jobs but at each time I would like to at most run 4 nohup jobs.
Is there a way to:
keep track of 4 nohup job status
once one of them finishes, it triggers ...
2
votes
1
answer
148
views
Algorithm to find longest common substring
I'm having a bit of trouble coming up with a general solution to the following problem.
First a bit of context.
End goal: set file permissions on all files and directories created by a rpm
My plan was ...
0
votes
0
answers
817
views
Reference shell Script within a shell Script in YAML
Is there the right way to reference a shell script written within a script in a YAML file. For eg:
data:
ex1.sh: |
#!/bin/bash -x
. /shellscriptloc/ex2.sh
...
...
0
votes
2
answers
507
views
Bash printf: what does format specifier %P mean?
The printf statement :
find directory1 -type d -printf "%P\n" | sort > file1
in the answer https://superuser.com/a/166322/856910 includes a format specifier %P. From the output of this ...
0
votes
1
answer
642
views
Running shell Script via Systemd.timer
So I've essentially run into the same problem as in my other question: Running shell Script via Crontab
I will now run my shell script with systemd.timer but it is not working so far.
Here is my ...