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

How to read from sqlite database with dash?

In bash, I use this to read from a sqlite database: TMP=`echo "select * from Table limit 1;" | sqlite3 mysqlite3database.db` tokens=(${TMP//|/ }) PARAM_1=${tokens[0]} PARAM_2=${tokens[1]} PARAM_3=${tokens[2]} PARAM_4=${tokens[3]} This unfortunately…
Robby75
  • 3,285
  • 6
  • 33
  • 52
0
votes
1 answer

Changing from tcsh to bash?

I am having difficulty with some shell commands and think that it is due to a failure of my shell being set to BASH. The following commands solve my problem: bash --login Or simply by typing bash Therefore it seems that I need to reconfigure my…
Joe
  • 13
  • 1
  • 1
  • 3
0
votes
1 answer

Weird behavior in sh with `set -e` and a subshell

The code below prints Continuing if I remove the subshell. With the subshell, I need another succesful call after the test (using : as a succesful no-op command is most straightforward, IMO) if I want to get to the Continuing part. #!/bin/sh set -e…
Petr Skocik
  • 58,047
  • 6
  • 95
  • 142
0
votes
1 answer

How to limit the CPU usage of a dash loop that listens for a filesystem change?

I wrote a loop in dash which waits for a file to appear in a certain location on the filesystem. But when it runs it takes up 50% of the CPU. I first lowered the CPU usage using a sleep command but the minimal sleep time in dash (1 second) is too…
timakro
  • 1,739
  • 1
  • 15
  • 31
0
votes
1 answer

unexpected "then" expecting "done" in dash : how will I insert an if condition inside a for loop in dash?

I'm using dash and I need to create CGI script that will parse the query string and save each value to a variable OLDIFS=$IFS // use & as delimeter IFS='&' //this will loop the queryString variable for line in…
user3714598
  • 1,733
  • 5
  • 28
  • 45
0
votes
2 answers

Arguments not found in shell script

I am trying to write my first shell script for a class. The goal is to take a list of integers as a command line argument and display their squares and the sum of the squares. I am getting an error that the arguments are not being found. This is…
snaper
  • 5
  • 3
0
votes
2 answers

Check string for substring with dash

I want my motd to make a nice overview of my system status. ATM I'm trying to check if a deamon is running or not and color it accordingly to it's status. So normally you would enter deamon_name status and it outputs something like Deamon_name…
globus243
  • 710
  • 1
  • 15
  • 31
0
votes
2 answers

Linux shell script with file saving and sequential file naming

I am working with a Ethernet camera that comes with Busybox. A single board computer is connected to it through RS232. The SBC needs to send a single command to the camera in order to take a jpg snapshot, save it to a CF memory card and name it in a…
Rick
  • 45
  • 9
0
votes
1 answer

If IP is pingable then do something (convert bash command to dash)

I have a command that should open a program after reboot if a specific IP is reachable. I use Debian so sh is linked to dash. The code that i execute after system start is: sh -c "sleep 10 && if ping -c 1 stackoverflow.com &> /dev/null; then gedit;…
0
votes
2 answers

In Terminal, what's the difference between "cd /" and "cd ~"?

I don't understand the difference between these two. They both seem to take me to the root directory. Are there differences?
0
votes
1 answer

Bourne shell "printf %s" usage

I have a simple debug_print shell function that I use to help write larger shell scripts. In general, I try to write only Bourne-compatible scripts and avoid Bash-isms. In this case, the Bash version of my debug_print function works fine, but I…
0
votes
1 answer

variable variables in sh or dash

The following code executes fine on bash. sms="SMSFile" email="EmailSubj" for x in sms email; do echo variable \$$x=${!x}; done; Output is variable $sms=SMSFile variable $email=EmailSubj But I need to write it in sh NOT bash. if I execute same…
Shiplu Mokaddim
  • 56,364
  • 17
  • 141
  • 187
0
votes
2 answers

Execute Command From String Dash Linux

So i am trying to learn how to write scripts for Linux OS's so I wrote this download and install script. Although, I know that any good coder for linux would think this is absolute skid work, It works up to par so far so I just have one error at the…
-2
votes
1 answer

How do I get screen resolution in a shell script on Linux

Environment System: Linux Mint 18 / 19 Cinnamon 64-bit. Shell: dash (POSIX). Question I need to dynamically account for the screen resolution in a POSIX shell script. I prefer a function for re-use.
Vlastimil Burián
  • 3,024
  • 2
  • 31
  • 52
-3
votes
2 answers

echo prints too many spaces

I have code with two variables in echo. I don't know why it prints spaces before $NEXT even though I have just one space in code. NEXT=$(find "${DIR}" -type f -name "*.$ext" | sed "s/.*\/\.//g" | sed "s/.*\///g" | sed -n '/.*\..*/p' | wc -l) echo…
user3463055
  • 121
  • 2
  • 9
1 2 3
10
11