0
votes
1answer
68 views

Can I use an if statement to detect if bash and dash are being run interactively? [duplicate]

After looking around for a while I've found several good pages describing how to check and see if a bash script is running interactively and there seem to be several methods, but one of them that I ...
2
votes
1answer
54 views

What is happening when a script encounters an error in one of the commands?

I used alien to convert an RPM to a .deb. I did NOT use alien's script conversion; I'm converting by hand. Indeed, the script did barf on some non-compatible syntax. My question is NOT about how to ...
4
votes
2answers
626 views

Get line number in a Bourne shell script

I'd like to be able to print the current line number in a shell script. I know about the $LINENO variable in Bash shells, but it doesn't seem to exist in Bourne shells. Is there any other variable ...
6
votes
1answer
717 views

Are dash, ash and sh script 100% compatible?

I wanted to know whether scripts written for dash, ash, and sh are 100% compatible? Are there any added features to dash or ash, or syntax change? From what I heard, ash is a direct descendant of ...
2
votes
2answers
865 views

When sh is a symlink to bash or dash, bash limits itself to POSIX-compliance, so it should be 100% compatible with sh?

From Difference between bash and sh: ABck to the question: If you have /bin/sh as a link to bash, then bash will not behave the same when called as /bin/sh as it does when called as /bin/bash. ...
5
votes
1answer
998 views

A couple arithmetic related commands, Dash, POSIX shell, sh, Increment

When pre/post incrementing a variable, in POSIX Shell, what is the difference between these two examples. They seem like they would have the same consequences, but would they be used differently? ...
4
votes
1answer
360 views

In a script, check if standard input comes from a file or pipe

I know this has been poorly covered previously, but those answers either lack explanation or don't apply. Basically at some point my scripts needs check if a file is specified, if it was it will be ...
0
votes
1answer
1k views

How to pkill from a script?

How can I write a script that basically just runs pkill -HUP inetd? I want to restart inetd via a script so I can schedule it to run at a particular time. I tried to write it myself, but I'm getting a ...
4
votes
2answers
356 views

Can I trace a dash script without modifying its source code?

I would like to trace a shell script for debugging purposes without having to modify its source code (e.g. change the shebang or insert a set -x at the beginning). It is a dpkg postinst script, so not ...
1
vote
1answer
149 views

How does this bash function work?

I'm looking at this short example, and I don't see how this function works: function EXT_COLOR () { echo -ne "\[\033[38;5;$1m\]"; } AFAIK -ne stands for not equal. What are we comparing here? I ...
2
votes
4answers
1k views

Shell script error message

I am trying to learn shell scripting by reading linuxcommand.org. For some reason I keep getting the error "Not Found", even though it runs all the commands. The error codes I get are: ...