Linked Questions
14 questions linked to/from How to debug a bash script?
1
vote
1
answer
456
views
check shell scripts [duplicate]
is there any software, like lint for C, to check shell scripts ?
check
the syntax
the compatibility with bash ksh etc...
online web service or installable as program
I don't want to run and debug. ...
7
votes
3
answers
12k
views
How to debug/trace bash function?
I have a bash script myscript.sh, which has a bunch of functions inside. To run one function, I would write
source myscript.sh; myfunction
How debug such a function?
8
votes
1
answer
13k
views
How redirecting debug output to a file [duplicate]
I use -x for debug info while executing the shell script.
How can I redirect debug info only to a file?
Example script:
#!/bin/bash
echo OK
echo NO
i will get the below result when i run in debug ...
4
votes
1
answer
5k
views
Echo out lines of script before running them
Is there a way to run scripts in bash that makes it so that it prints each line of the script before executing it? This would be really useful to me for debugging...
$./myscript.sh
echo "Hello"
...
2
votes
3
answers
5k
views
Creating a new file inside awk but in different directory based on input field value
I am trying to work with awk
datetime=`date +\%Y\%m\%d`
logdatetime=`date +\%Y\%m\%d`
foldermonth=`date +\%B_\%Y`
folderday=`date +\%d`
inputdir="~/sboper/Standalone/fsplit/GLMS"
...
1
vote
2
answers
3k
views
bash question about if and then [duplicate]
I'm writing this in my script. It has other parts but I'm getting stuck on this part only.
if [[$# == $year $month $day ]] ; then
cal $day $month $year
fi
When I run this it give me this msg:
[...
4
votes
1
answer
4k
views
Write the same file multiple times to one file using dd
I am trying to create large dummy files on a drive using dd. I am currently doing this:
#!/bin/bash
writeFile(){ #$1 - destination directory/filename, $2 - source filepath $3 - blocksize, $4 - ...
0
votes
1
answer
832
views
What's wrong with my elif statements in this rock paper scissors game I'm making [closed]
making a rock paper scissors game to learn better bash. For some reason it's not liking my elif statements and I can't figure out why. Also if there are any better ways of doing this let me know, ...
1
vote
1
answer
1k
views
How can I run script for all directories?
Suppose I am at the main directory which contains script.sh and subdirectories, each of subdirectories contain images.
The script.sh is a script for resizing images. I want to apply this script to ...
0
votes
1
answer
788
views
ffmpeg bash script segment template
I was trying to control ffmpeg file segment function through a bash script to cut a large movie file into smaller pieces.
I took a look at the documentation here but this doesn't really cover what I ...
2
votes
2
answers
176
views
bash: expecting number addition with +=. Not exactly sure if the operand is a number
I am trying to detect armstrong numbers with this code:
declare -i INPUT=$1
arr=($(fold -w1 <<< "$INPUT"))
for index in "${!arr[@]}"
do
armstrong_sum+=$((${arr[index]}**${#arr[@]}))
done
...
1
vote
1
answer
114
views
Inserting variables in a file path on GNU linux (SLES 11)
I am tryin to insert 3 variables to build a path, but unable to get it .
I am trying the below
log_path="/vol02/logs/$dname/logs/103602_$msname/${msname}_start.log"
dname=cfp
msname=cfp003
i get ...
1
vote
1
answer
76
views
Why can't I execute this script?
I am trying to execute a script to determine its system running time and potentially fix its problems.
If I type:
{hostname@bankofamerica]$ ./xx-xxx-xxxxx.sh
[sudo] password for hostname:
_
It ...
0
votes
1
answer
59
views
downloading git using shell
Im trying to download git using a .sh file for vagrant but when it gives me the prompt to continue, it aborts automatically. This is the contents of my .sh file:
#!/usr/bin/env bash
sudo apt-get ...