dash-shell Questions

4

Is there some similar option in dash shell corresponding to pipefail in bash? Or any other way of getting a non-zero status if one of the commands in pipe fail (but not exiting on it which set -e ...
Preemie asked 19/7, 2013 at 23:34

3

Solved

I have a dash shell installed as /bin/dash. I checked the manual of dash, which is the same as the POSIX shell manual, and there is nothing there to tell the version of the shell. dash --versio...
Progressist asked 16/4, 2016 at 6:2

3

Solved

I got different behaviors with the same command echo -ne "hello\n" with bash and with dash. See below : $ bash -c 'echo -ne "hello\n"' hello $ dash -c 'echo -ne "hello\n"' -ne hello Why is...
Parmesan asked 18/11, 2015 at 16:8

5

I'm writing a bash script and it throws an error when using "sh" command in Ubuntu (it seems it's not compatible with dash, I'm learning on this subject). So I would like to detect if dash is being...
Asthma asked 11/4, 2014 at 11:29

4

Solved

According to this reference sheet on hyperpolyglot.org, the following syntax can be used to set an array. i=(1 2 3) But I get an error with dash which is the default for /bin/sh on Ubuntu and sh...
Sorites asked 13/2, 2016 at 22:14

4

Solved

A POSIX compliant shell shall provide mechanisms like this to iterate over collections of strings: for x in $(seq 1 5); do echo $x done But, how do I iterate over each character of a word?
Preoccupy asked 26/6, 2018 at 23:5

2

Solved

I would expect the second line to say foo instead of command not found: $ alias foo="echo bac" ; foo; -bash: foo: command not found $ foo bac $ Why won't the second line say foo? Tested with the...
Illmannered asked 22/7, 2016 at 12:36

2

Solved

I'm trying to write a shell script that aborts when a command fails and displays the offending line number. set -e trap 'echo "$0 FAILED at line ${LINENO}"' ERR Turned out the trap line does not...
Thecla asked 9/7, 2015 at 9:22

2

I'm getting different outputs when running the program in bash and dash #!/bin/sh echo $SHELL n=1 a=$((++n)) echo $n Bash: $ bash shell_test.sh 2 Dash: $ dash shell_test.sh 1
Urbanism asked 24/9, 2018 at 13:55

1

Why import subprocess p = subprocess.Popen(["/bin/bash", "-c", "timeout -s KILL 1 sleep 5 2>/dev/null"]) p.wait() print(p.returncode) returns [stderr:] /bin/bash: line 1: 963663 Killed tim...
Engage asked 22/8, 2017 at 18:53

4

Solved

I am trying to have a sourced shell script determine its own location, and I have found that this is a difficult task for dash. In bash, sh, and csh, I can use: $_. In fish, I can use (status -f...
Orthohydrogen asked 6/10, 2015 at 23:18

2

Solved

When moving from Ubuntu 14.04 to 16.04, I've noticed several of my Bash scripts failing due to missing exported functions. I wonder whether this is related to the fixes for the Shellshock bug, even...
Prochronism asked 28/6, 2016 at 15:5

3

I mean I want to use unset that is not a shell function itself. If I could do that, I could make sure that command is pure by running #!/bin/sh { \unset -f unalias command [; \unalias unset comman...
Roberto asked 10/3, 2016 at 12:49

7

Solved

I am writing a shell script which works on my local /bin/sh fine (dash on Ubuntu 13.04), but I unltimately need to run it on a dumb box where I'm getting an error because of an operation on variabl...
Ideography asked 2/5, 2013 at 5:43

2

Solved

There's several shell-specific ways to include a ‘unicode literal’ in a string. For instance, in Bash, the quoted string-expanding mechanism, $'', allows us to directly embed an invisible character...
Staff asked 26/12, 2014 at 3:8

5

Solved

What is the portable and canonical way to test if variable is empty/undefined in a shell script? It should work in all sh-like shells. What I do now is something like: if [ -z "$var" ] ; the...
Lewendal asked 5/11, 2013 at 7:41

1

Solved

I'd like to list the currently defined functions in dash. Is there any way of doing that? The closest I've been able to come up with is type which can be used to test if a function exist, but othe...
Outgroup asked 21/7, 2014 at 15:20

3

Solved

In bash, php/{composer,sismo} expands to php/composer php/sismo. Is there any way to do this with /bin/sh (which I believe is dash), the system shell ? I'm writing git hooks and would like to stay ...
Second asked 23/7, 2013 at 9:48

2

Solved

I'm studying System V init scripts found in /etc/init.d/ in current Debian 7.4.0 wheezy release(But its also present in other, previous, releases). Almost all of them (from existing services) found...
Preamplifier asked 1/4, 2014 at 14:28

5

Solved

I am trying to compare two strings in a simple shell script. I was using /bin/sh instead of /bin/bash, and after countless hours of debugging, it turns out sh (which is actually dash) can't handle ...
Omaromara asked 7/7, 2009 at 0:20

2

Solved

I want to use subshells for making sure environment changes do not affect different iterations in a loop, but I'm not sure I can use loop control statements (break, continue) inside the subshell: ...
Inspan asked 29/1, 2014 at 12:37

2

Solved

I have bash script and it requires bash. Another person try to run it with sh script_name.sh And it fails because sh is symbolic link to dash in his distribution. $ ls -la /bin/sh lrwxrwxrwx ...
Avertin asked 23/10, 2013 at 10:5

2

Solved

I'm trying to find a way to run multiple commands in parallel in sh and wait for it completion. I've found that following doesn't work (sh: 1: Syntax error: ";" unexpected): sh -c '(sleep...
Iorgo asked 3/6, 2013 at 20:21

3

Solved

I'm getting this error Syntax error: redirection unexpected in the line: if grep -q "^127.0.0." <<< "$RESULT" How I can run this in Ubuntu?
Hammack asked 16/4, 2013 at 19:10

1

Solved

In the dash shell environment I am looking to split a string into arrays. The following code works in bash but not in dash. IFS="" var="this is a test|second test|the quick brown fox jumped over t...
Alguire asked 29/1, 2013 at 23:29

© 2022 - 2024 — McMap. All rights reserved.