Questions about shell scripts, executable files that are interpreted by a shell (bash, zsh, etc.).
0
votes
1answer
10 views
How can i handle hogging process before system freeze?
First of all hello, and thank you for taking the time to read my question.
What my desired outcome with this question is to know if there is a already a script/tool etc made for handling hogging ...
0
votes
0answers
15 views
Execute a list of commands with checkpointing?
I have a script that does a complicated shutdown and restore procedure. It has some long running commands executed in it. Some take about ten minutes, some are faster.
Is there some piece of software ...
0
votes
3answers
17 views
How do I use an If-Else to do certain things if the days of the week are set of days?
I have a requirement that if a day of the week is either Monday, Tuesday or Wednesday , perform certain scripts otherwise I don't do anything.
if [[ $(date '+%a') == "Mon" && $(date '+%a') == ...
0
votes
1answer
13 views
How to resize image scan to text content?
I make a script witch scan papers and send it by mail.
But in some cases there is a lot of blanc space in the scaned image and I would like to automatically resize image to content.
So, for example, ...
0
votes
1answer
35 views
Redirect grep error output inside if conditional
I have written a script to search an .ini file for some specific word.
The .ini file has one of two different names, (let's say config.ini or configuration.ini), so I have to check in both.
I am ...
0
votes
1answer
37 views
iterate script execution: A call B, B call A
I have a script scriptA.sh that if a variable assume a certain value, it has to execute another script scriptB.sh that execute something and then call a scriptA.sh, that will call a scriptB.sh and so ...
0
votes
0answers
20 views
How to understand the diffrent order of redirections means? [duplicate]
In the Bash Reference Manual:
Note that the order of redirections is significant. For example, the
command
ls > dirlist 2>&1 directs both standard output (file descriptor 1) and
...
5
votes
1answer
273 views
Does bash have different weak quoting rules for special variables?
I don't think I fully understand the nuances of quoting in bash.
I have a script, foo.sh, which simply outputs numbered arguments.
#!/bin/bash
i=1
while [ $i -le $# ] ; do
v=$(eval "echo \$$i")
...
0
votes
1answer
30 views
Need help for Linux Bash script
I have bash script
#!/bin/sh
export DEBIAN_FRONTEND=noninteractive;
apt-get update;
apt-get -y upgrade;
apt-get install -y python-pip python-dev nginx;
##After the command output shows visible ...
0
votes
1answer
17 views
Redirecting the output of a script to the remote server via scp or ssh
I have a script which does ssh to all the servers and shows the output for each execution; can I redirect those outputs to /var/tmp/filename_output.txt on server1?
The script runs from server1 to all ...
0
votes
0answers
29 views
Please find the below question for ksh and dot [duplicate]
iN LINUX When we try to execute any script with . it’s being executed and its showing the result.
$ . /opt/CA/r11.3/autouser.PC3/autosys.ksh.PC3
$ echo $AUTOSERV
PC3
Whereas when we do the same with ...
1
vote
3answers
48 views
Why doesn't the last function executed in a POSIX shell script pipeline retain variable values?
Assume the following script:
#!/bin/sh
func1() {
eval $1'=$(cat)'
eval echo "Value$2 inside function : \$$1"
}
func1 x 1 <<'HEREDOC'
Hello World
HEREDOC
echo "Value1 outside function: $x"...
6
votes
0answers
97 views
What does POSIX require for quoted here documents inside command substitution?
In this question someone reports a problem using a here document with a quoted delimiter word inside $(...) command substitution, where a backslash \ at the end of a line inside the document triggers ...
0
votes
1answer
23 views
requesting to show the critical output as a result
I am having a health check script which run's perfectly, but I want to modify it in such a way that the critical disk should be shown in the output.
echo -e "
#######################################...
5
votes
7answers
748 views
Replace anything between parentheses even if spanning multiple lines
I would like to use bash or shell script and replace anything between the two parentheses with an empty space. The text between the two parentheses could be in multiple lines, such as:
myFunction (...