Skip to main content

Questions tagged [dash]

The Dash shell, a POSIX-compliant derivative of the Almquist shell used as /bin/sh in Debian, Ubuntu and other Linux distributions

1 vote
0 answers
255 views

I get permission denied for a command in an sh script, but same command works from terminal

I have a service run by systemctl in RedHat 8.8. The service itself is relatively simple: cat /etc/systemd/system/myservice.service [Unit] Description=My service After=network-online.target [Service]...
Gábor Major's user avatar
1 vote
1 answer
151 views

dash script replace array

This script works if I use bash on my Debian 11 (bullseye). But now I need to refactor it to use Debian's sh shell(/bin/dash). #!/bin/dash var1=1 var2=2 var3=3 arr=($var1 $var2 $var3) exist_var=&...
tuytuy20's user avatar
7 votes
2 answers
1k views

How do I keep a dash shell script running despite any error?

I have a dash shell script that is intended to run to the end of file: #!/usr/bin/dash # File b_shell . a_nonexistent_file echo "I want to print this line despite any previous error." ...
zanetu's user avatar
  • 171
2 votes
1 answer
89 views

How to add a substring to a string as a column

The title may not be the best at describing the issue, but this was the best I could come up with, moving on to describe what I'm trying to do, I use artix runit as my os, and it is tedious to create ...
Stagnant's user avatar
2 votes
1 answer
107 views

Anyway to bind keyboard to dash (Debian Almquist Shell)?

Specifically Up/Down for history navigation. What I already know I understand dash is a minimalistic, no bloat, (somewhat) strict POSIX shell. I understand the philosophy behind it, and the reason ...
Lockszmith's user avatar
3 votes
1 answer
404 views

Why is "${1-"$var"}" (option 6 down below) not mentioned in POSIX?

The only reference I could find in the spec is this: It would be desirable to include the statement "The characters from an enclosed "${" to the matching '}' shall not be affected by ...
QuartzCristal's user avatar
3 votes
1 answer
704 views

Debian /bin/sh in a Docker container never seems to look at .profile

I can not seem to get dash to look at $HOME/.profile: pedz@Peace:s001 ~[S:hatred] % docker exec -it hatred-web-1 dash -i # cat $HOME/.profile PROOF=true; export PROOF PATH=/hatred/bin:$PATH; export ...
pedz's user avatar
  • 173
1 vote
1 answer
1k views

Multiple commands in variable? [duplicate]

Is it possible to execute multiple commands stored in a variable? Singe command works fine variable="echo HELLO" $variable HELLO I would like to have something like this variable="...
user avatar
7 votes
2 answers
909 views

Is there a pipefail equivalent for dash?

I have a perl script that runs a system() call to execute shell commands and I would like to run more than one command and pipe data between them. Something like (in perl): system("command1 | ...
terdon's user avatar
  • 245k
7 votes
1 answer
1k views

Why doesn't sudo always spawn a shell sub-process?

I am trying to understand why some shells seem to receive a special treatment when called with sudo. For instance, there seem to be two possible behaviours: The "implicit" group (pstree is a ...
mesr's user avatar
  • 407
1 vote
1 answer
433 views

Bash for every x files create sub folder and move files there

I am looking for an alternative dash command I can use as I am trying to execute the code from within python and due to the fact that the sub folder has 100's of files I am am trying to group into ...
jessyjack's user avatar
2 votes
0 answers
274 views

how to close file descriptor bigger then 9 by dash in shell script

I want launch a shell script in code called system("sh example.sh"), and close all file descriptors like this: for fd in $(ls /proc/$$/fd); do case "$fd" in 0|1|2) ;;...
meilin's user avatar
  • 21
0 votes
2 answers
1k views

Sourcing file in dash with . file gives "not found" error

I'm trying to source (bash-parlance) a file in dash using . file as specified by the man page: . file The commands in the specified file are read and executed by the shell. But I ...
cheersmate's user avatar
7 votes
1 answer
672 views

What parts of dash are not part of the POSIX standard?

I know that dash adheres quite closely to the POSIX standard, but I know that it's not 100.00% strict POSIX without any extras. The shell that comes closest/adheres exactly to the POSIX standard is as ...
cubernetes's user avatar
1 vote
1 answer
435 views

SHELLOPTS equivalent for /bin/dash

I have to run a number of shell scripts that are defined by a third party. So I cannot (or would prefer not to) change their content or which shell (bash vs. dash) they are using. They may or may not ...
Christopher's user avatar

15 30 50 per page
1
2 3 4 5
12