Questions tagged [dash-shell]

A POSIX-compliant shell implementation that aims to be as small as possible. Please use the [hyphen] tag instead of [dash] if your question is about the "-" character.

The Debian Almquist shell (dash), a modern replacement for , is a POSIX-compliant Unix shell. It requires less disk space than , for example, but it is also less feature-rich.

Resources

151 questions
0
votes
1 answer

dash script, send yes for a command

I want to call a command with a script using dash. here is my code: #!/bin/sh ip='172.45.0.219' cmd1='yes yes' cmd2="./ssh foo@$ip" eval $cmd1 | $cmd2 when I run my script this is my output: Pseudo-terminal will not be allocated because stdin is…
R.A.
  • 9
  • 6
0
votes
1 answer

How to close a dd process that was started in a dash script with -SIGINT?

When I start a dd process directly from the Terminal with dd if=/dev/zero of=/dev/null & command, and send to it a -SIGINT with kill -SIGINT command, it closes successfully. But when I start the process from a script #!/bin/sh dd…
0
votes
1 answer

Loop through a list of files with a specific MIME type in sh

I have a directory, and need to get a list of files with MIME types of application/pdf, which I can loop through and process with my CompressPdf function. The remaining files only need to be copied over the destination directory using cp, for which…
Livy
  • 631
  • 4
  • 15
0
votes
0 answers

Want to respond to the output of a script, but limit responses to every second; POSIX

I am trying to write a script (for dash, so I want it posix compliant). What I want the script to do is print me the name of my currently connected SSID (in json format). This info is to be processed by my status bar (polybar, waybar and i3status).…
0
votes
1 answer

How can I skip the first argument in an ash/dash shell function?

In an ash/dash function, I can refer to the full parameter list like this: allparameters() { echo "$@"; } Which gives me: $ allparameters yyyyy abffcd efgh yyyyy abffcd efgh I want to skip yyyyy, so I tried ${@:2}: butlast() { echo "${@:2}";…
Aankhen
  • 2,198
  • 11
  • 19
0
votes
1 answer

Error: Using Bash script inside Declarative Jenkinsfile

I am facing some challenges to write my bash script code inside the Jenkinsfile. UserCase: I am keeping multiple tools code in the folder structure in one GIT repo. I want whenever any developer makes the change to the individual folder, a build…
0
votes
0 answers

How to fork shell to foreground instead of background?

I want to use a shell script to check if it is interactive. If so, it should spawn a fish and continue the rest of the script in the background. Otherwise, it should not run fish and continue running the rest of the script. How I check if the shell…
John Doe
  • 1
  • 1
0
votes
2 answers

/bin/dash: Bad substitution

I need to do a string manipuilation in shell script (/bin/dash): #!/bin/sh PORT="-p7777" echo $PORT echo ${PORT/p/P} the last echo fails with Bad substitution. When I change shell to bash, it works: #!/bin/bash PORT="-p7777" echo $PORT echo…
Martin Vegter
  • 136
  • 9
  • 32
  • 56
0
votes
1 answer

How should I start bash with dash?

I work on a ubuntu server and I don't have the root permission. The default shell is dash. When I try to change the default shell,it tells me it don't have permission. user@host:~$ chsh -s "which zsh" You may not change the shell for 'binjie'. The…
nanimonai
  • 73
  • 6
0
votes
0 answers

Why Parameter Expansion is not working?

I am writing a script and in between. I am trying to replace all the commas of the string stored in a variable to spaces. basically the variable dpoint contains comma saparated floating point numbers like 0.0,4.2,3.6666 i am using…
sanjeevprasad
  • 804
  • 1
  • 6
  • 21
0
votes
1 answer

CERTAIN tab characters don't match in shell scripts, but do on command-line

I'm trying to do some simple parsing of the output of the xinput command in a shell script. What I am trying to do works perfectly on the commandline, but doesn't work in the script. Here is my commandline: xinput list | awk '/Name of my Device …
Tripp Kinetics
  • 5,178
  • 2
  • 23
  • 37
0
votes
0 answers

Docker run errors on passing a dash as an argument?

I need to pass -Dfml.queryResult=confirm to the executable of an otherwise working docker container (on the docker run line), but all I get is : -Dfml.queryResult=confirm: invalid syntax ... I've tried with quotes, no quotes, single quotes,…
0
votes
1 answer

sh: Is it safe to use a variable as a command if the command contains only letters, number and underscores?

I'm writing a POSIX compliant script in dash so I am having to get creative with using fake arrays. Contents of fake_array.sh fake_array_job() { array="$1" job_name="$2" comma_count="$(echo "$array" | grep -o -F ',' | wc -l)" if [ "$comma_count"…
Harold Fischer
  • 279
  • 1
  • 9
0
votes
1 answer

How do I force subprocess.call or os.system to run in bash, instead of dash?

Okay, so I've been struggling with this one for awhile. I'm trying to create a python3 script that automatically uploads a file to a server. In the commandline, the following command works like a charm: sftp -i key.pem -P 3912…
Noah
  • 78
  • 6