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).
Questions tagged [ash]
189 questions
0
votes
0 answers
eval variable assignment in a bash function causes variable to be local
I was trying out the answer to this question (the portion that is bash <= 4 compatible) when I noticed that bash behaved differently if the following line was in or out of a function. When in a function, the variables created by the eval were local…

Huckle
- 1,810
- 3
- 26
- 40
0
votes
1 answer
bin mounted to alpine container fails to run with /gogs not found
I'm building gogs from source and using
COPY gogs /home/git/go/src/github.com/gogits/gogs
to add the folder containing the built gogs bin and it's files to my container.
If I cd to /home/git/go/src/github.com/gogits/gogs I can see the file, I can…

Jonathan
- 10,792
- 5
- 65
- 85
0
votes
1 answer
Get enviroment variable from string with ash
Consider the following:
/ # echo $TEMPLATEGO_SERVICE_HOST
192.168.1.1
/ # export string="TEMPLATEGO_SERVICE_HOST"
/ # echo $string
TEMPLATEGO_SERVICE_HOST
With bash I can do:
/ echo ${!string}
192.168.1.1
If I try the same with ash, I get the…

CESCO
- 7,305
- 8
- 51
- 83
0
votes
1 answer
Turning a bash script into a busybox script
I am working on a device that only has busybox (ash?) and does not support bash. However, I need to run the bash script below on it. Is it possible or busybox simply does not support…

relima
- 3,462
- 5
- 34
- 53
0
votes
1 answer
Killall doesn't work if I call it from a bash script
I'm starting a tcpdump inside a script and I also kill it from the same script. So I'm currently using the killall command for this: The script gets executed from an udev rule: This is the section, which should terminate the tcpdump: In addition I…

aha364636
- 365
- 5
- 23
0
votes
1 answer
Command is started more than once in bash script
I'm trying to start one tcpdump in with my script. But I always get more than one. That's my ps output:
1260 root tcpdump -i br0 -C 1024 -w /media/usbhd-sdc2/pcaps/abfrage2.pcap
1267 root tcpdump -i br0 -C 1024 -w…

aha364636
- 365
- 5
- 23
0
votes
1 answer
Change code to get it working in sh or ash
I wrote a function to read the time from a config file and calculate it to seconds.
The line in the config file looks like that:
timeend=30h
The function was written in for bash, but in the Linux Distro I use there's no bash avalaible, only sh and…

aha364636
- 365
- 5
- 23
0
votes
1 answer
Insert string in file with sed
I have a file tmp with the following content.
1554 file
I want to insert a string with sed command. I use this command
sed -i '//a "HELLO"' tmp
but the string "HELLO" is not inserted after the tag. What's wrong…

Anis_Stack
- 3,306
- 4
- 30
- 53
0
votes
1 answer
SHA 256 for android app
I have in PHP this method to call a security web service:
// token generator; date is UTC/GMT
$tokenNewInputData = date("Y-m-d");
$tokenNew = hash_hmac('sha256', $tokenNewInputData, KEY);
echo ‘token: ‘.$tokenNew;
where KEY it's "password" text.
I…

DEV
- 31
- 1
- 7
0
votes
1 answer
Busybox ash bug - cannot concat strings in while loop?
When programming with Busybox ash, str in following program will be changed in every while loop as expected, but after while loop the str becomes empty again. /tmp/term_mon_ttys is a test file.
#!/bin/ash
cnt=0
str=
cat /tmp/term_mon_ttys | while…

boyang
- 667
- 1
- 8
- 22
0
votes
1 answer
error sh: 0: not found while converting bash function to sh
The function below was originally a bash function. I need it to run in busybox 1.22 ash shell.
dockerip() {
if (( $# != 1 ))
then
for d in $(docker ps -q)
do
name=$(docker inspect -f {{.Name}} $d)
ip=$(docker inspect -f…

SpliFF
- 38,186
- 16
- 91
- 120
0
votes
6 answers
How to move some lines to the top of the file?
I have a file like this:
aaa.bbb.1.ccc
xxx.bbb.21
mmm.ppp
xxx.eee
mmm.qqqq
xxx.hhh.12.ddd
I want to move all the lines starting with xxx. at the top of the file with a simple command (using sed, awk, grep...).
So my new file will look like…

MOHAMED
- 41,599
- 58
- 163
- 268
0
votes
1 answer
Should I make a race condition check on a parallel sed executions on the same file?
I have many scripts shell that are executing at the same time and they make sed on the same file. So there is a risk that the sed command exeute at the same time and on the same file.
Should I make a race condition check on a parallel sed…

MOHAMED
- 41,599
- 58
- 163
- 268
0
votes
1 answer
check if elements of string exist in another string
I have two strings:
l1='a1 a2 b1 b2 c1 c2'
l2='a1 b3 c1'
And I want to check if each element of string l2 exists in l1, and then remove it from l1.
Is it possible to do that without a for loop?

stack_A
- 713
- 4
- 13
- 21
0
votes
1 answer
How to use set to set complex arguments of a shell functions
I want to execute a function with complex arguments
I want to input them in this way (if it is possible?)
set [-options here] a111 "a222" "a333 a333" "a444"
set [-options here] b111 "b222" "b333 b333" "b444"
set [-options here] c111 "c222" "c333…

MOHAMED
- 41,599
- 58
- 163
- 268