Questions tagged [ash]

A shell(ash) written by Kenneth Almquist and released to the comp.sources.unix Usenet news group on May 30th 1989. It has features similar to the Bourne shell(sh). Its many derivatives include the system shell on; Debian (dash), FreeBSD (sh), NetBSD (sh) and the default shell in Busybox (ash).

172 questions
0
votes
1 answer

How to check for extra parameters in ash script?

I have an ash script where I need to check whether the user has entered anything stupid. The proper use is: script -s [-f filter] [-n number] And I need to detect if user has for example evoked it like: script read…
ThePiachu
  • 7,295
  • 15
  • 57
  • 93
0
votes
1 answer

Ash pidfile showing wrong process id

I've got a really simple wrapper script to start a ruby program that monitors a network connection. The script's on router - hence we're using ash, not bash. Since we're using monit to monitor the status, I need a PID file. The problem is, the…
simonmorley
  • 2,714
  • 3
  • 26
  • 58
0
votes
1 answer

How can I have variable redirection in a shell script?

If I have a script with the command echo xx 2>&1 >junk I get a file with "xx" in it. If I have a script with R="2>&1 >junk" echo xx $R the script prints "xx 2>&1 >junk", instead of creating the file I desire. How can I have a redirection that is…
rich
  • 379
  • 2
  • 16
0
votes
1 answer

Unexpected redirection while parsing string

I have a string that parses files. But when i execute it. It gives an error. Here is the code; config="/tmp/files.config" tftp $TFTP_SERVER_IP -c get "files.config" "$config" while read line do IFS='=' read -a current_line <<< "$line" tftp…
Alperen Elhan
  • 352
  • 2
  • 5
  • 15
0
votes
1 answer

How to get variable from other while loop?

#!/bin/bash read() { count=0 cat localfile | while read line do FILE[$((count += 1))]="$line" done } read for((i=0;i<${#FILE[@]});i++) do echo ${FILE[i]} done The result of echo is whole blank. Is there any way to…
0
votes
1 answer

ASH if statement in a if statement

I've seen many examples with multiple conditions related to each other, but there are 2 different unrelated conditions where the second one only should happen if the first one is true. How can I get the following nicely organised and in 1…
Nixx
  • 15
  • 1
  • 6
0
votes
2 answers

Generate color fades via (B)ASH

I have a linux/bash script that sends multiple RGB color fades to multiple light. Every light can have it's own color but all colors should use the same amount of time to fade in/out. So it sends out a sequence of 3 differently targeted value-ranges…
Nixx
  • 15
  • 1
  • 6
0
votes
1 answer

BusyBox - syntax error: unexpected redirection

I'm on OpenWRT (which uses BusyBox). When I run this script: while read oldIP ; do iptables -t nat -D PREROUTING --dst $oldIP -p tcp --dport 443 -j DNAT --to 192.168.2.1:443 done < <(comm -23 <(sort /tmp/currentIPs) <(sort /tmp/newIPs)) I get…
exvance
  • 1,259
  • 4
  • 12
  • 30
0
votes
2 answers

Can I use simply exitcode within test expression (without $?)?

I have to make a conditional in ash, that depends on result of two commands. The problem is one of them returns the result to stdout, the other as exitcode. Do I have to write command2 RET=$? if [ `command1` -eq 1 -a $RET -eq 2 ] ; then ... or…
SF.
  • 12,380
  • 11
  • 65
  • 102
0
votes
1 answer

Ash MATCH operator (=~)

I'm trying to fit a script for linux onto my WD world edition drive. The script is written for Bash (debian) but my WD only runs busybox (with ash). Despite this, I have gotten most functionality in there just from using Google. There is only one…
Delusional Logic
  • 780
  • 8
  • 30
-1
votes
1 answer

docker sh vs bash variable ${@} expansion - ${@} doesn't work in sh

It's really straightforward: I am trying to build a docker image where the entrypoint receives the args passed. When I use a bash shell, it works. When I use sh which comes with alpine it doesn't expand; and I think it's because sh takes no args at…
Christian Bongiorno
  • 3,923
  • 1
  • 25
  • 65
-1
votes
2 answers

Linux Ash Shell script to check if certain package is installed & called via docker

I'm trying to run docker on embedded Linux running OpenWRT. Since the embedded Linux is a "resource constraint" I don't want Docker to install already installed packages, therefore I want to call a custom shell script with docker: RUN $CMD_STRING =…
cyber101
  • 2,672
  • 11
  • 46
  • 81
-1
votes
5 answers

How to extract string between 2 xml tags?

I have a string like this my message How I can extract the message between the tags with sed or awk? So I get only "my message"
MOHAMED
  • 35,883
  • 48
  • 140
  • 238
-1
votes
1 answer

Linux compiled binary getting wrong exit code if Ctrl+C entered from a shell script launched by the binary

I've got what I think is a strange one here. I have the following environment. A Linux compiled binary which sets up a signal handler to disable things like Ctrl+C, Ctrl+z, etc. This is done by calling signal on: SIGINT, SITTSTP and SIGQUIT. The…
-1
votes
1 answer

Retrieve variable (or state file) from remote host using telnet?

I have wifi module as client that connected to my router (linux based firmware, Openwrt). And sometime, i need to retrieve GPIO state from wifi module. It can be done simply by connect in to usb serial and type print (gpio.read(1)) It will return…
1 2 3
11
12