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).

189 questions
2
votes
4 answers

awk error with "[" and "]" delimiters

I have string looks likes this string="xxxxx.yyyyy[2].zzzzz" I want to extract the number between the [ ]. I used the following awk command echo $string | awk -F'[]' '{print $2}' But this awk command returns error: awk: bad regex '[]': Unmatched […
MOHAMED
  • 41,599
  • 58
  • 163
  • 268
2
votes
2 answers

How to move file inside directory, using Linux (Bash)

I'm looking for a good shell one liner to move or rename a file inside a directory, where the target and destination parent directories are the same, and different than the current working directory. For example, the thing I don't want to write: $…
ErlVolton
  • 6,714
  • 2
  • 15
  • 26
2
votes
1 answer

Linux shell: write IP to binary file

Using ash, I have an IP address as a variable IP_ADDR=192.168.1.234 I want to write the 4 bytes to a binary file and later reread them and reform the IP string. I have the following working solution, but it seems very hacky - any better proposals?…
Philipp
  • 4,659
  • 9
  • 48
  • 69
2
votes
2 answers

How to sort lines based on a sub string in the line

I have the following output: aaa=12 bbb=124 cccc=1 dddd=15 I want to sort the above lines based on the value.s so the output should look like this: $ cat file | awk_or_sed_or_any_command cccc=1 aaa=12 dddd=15 bbb=124 UPDATE I tried the following…
MOHAMED
  • 41,599
  • 58
  • 163
  • 268
2
votes
5 answers

how to replace 2 new lines by one in the file

I have the following text file config 'toto' option option config 'titi' list list config 'tutu' list list I want to replace each 2 new lines by only one when I display the file with cat. I…
Anis_Stack
  • 3,306
  • 4
  • 30
  • 53
2
votes
1 answer

how to wget https on ubuntu?

I am wanting to try installing a hosted reddit: I just installed Ubuntu Server 12.04 on VirtualBox. Then i tried to run: $ wget https://raw.github.com/reddit/reddit/master/install-reddit.sh from the built in shell (ash) that begins lines with…
jsky
  • 2,225
  • 5
  • 38
  • 54
2
votes
1 answer

Find and Replace Inside a Text File from a ash Command

I need to modify href URLs in several html files on a fairly small embedded system that run ash shell and limited busybox. Sole functions available are: ash, brctl, chmod, cp, dnsd, free, halt, ifconfig, init, kill,ls, mkdir, mknod, mount, mv, ping,…
2
votes
1 answer

Equivalent of exec 3<>/dev/tcp/anyaddress.com/80 in ash

In bash the following command open a socket exec 3<>/dev/tcp/192.168.1.200/8080 In the ash this command does not work. Are there an equivalent of this command for ash? here after the output error of the command in ash: -ash: can't create…
MOHAMED
  • 41,599
  • 58
  • 163
  • 268
1
vote
4 answers

Shell script: how to read only a portion of text from a variable

I'm developing a little script using ash shell (not bash). Now i have a variable with the following composition: VARIABLE = "number string status" where number could be any number (actually between 1 and 18 but in the future that number could be…
Ivan
  • 4,186
  • 5
  • 39
  • 72
1
vote
1 answer

How to set commands that should be automatically executed in busybox ash?

I want a command to be excuted after busybox ash starts. I saw here that busybox ash is debian ash variant, and after seeing here, tried setting ENV=$HOME/.shinit; export ENV in file /etc/profile, and adding (BTW, this is to make Ctrl-C work in the…
Chan Kim
  • 5,177
  • 12
  • 57
  • 112
1
vote
1 answer

If statements with escape characters in Alpine Linux (ash busybox)

I have simple script to prepare file and it is working as intended. All code is executed at docker image alpine:latest (so ash busybox) echo "credentials \"url.com\" {token = \"${VALUE}\"}" > ~/.terraformrc Later I want to prepare test and I am…
Adasiek
  • 65
  • 1
  • 7
1
vote
1 answer

cgi-fcgi script is not executing corectly

Im using: /usr/local/bin # cat /etc/os-release NAME="Alpine Linux" ID=alpine VERSION_ID=3.12.7 PRETTY_NAME="Alpine Linux v3.12" with /bin/ash shell I have a script which check a status: #!/bin/sh full=$(DOCUMENT_URI=/api/$SERVICE_PREFIX/healthz…
a11eksandar
  • 145
  • 2
  • 10
1
vote
2 answers

How do I use ASMifier on inner classes?

I am trying to get an ASMified version of an inner class in java. My command looks something like this java -classpath "asm-all-3.3.1.jar:myjar.jar" org.objectweb.asm.util.ASMifierClassVisitor path/to/my/class$inner.class But it seems to only return…
Jark
  • 65
  • 1
  • 8
1
vote
0 answers

Check if stdin has data in busybox script ash or bash

Hi i am trying to create an ash script to read lines from stdin in a non blocking way. In bash i can do something like this: read -t 0 && read line But in ash on OpenWRT(LEDE version 17.01.16) i am unable to do this since on this version of OpenWRT…
TheCat
  • 11
  • 2
1
vote
1 answer

busybox shell error: line 9 (left square bracket): not found

I have the following code and I get the Error "line 9: [: not found": #!/bin/sh msg=$(dmesg | tail -n1) echo "$msg" if [ "$msg" = "Tasklet grp12" ] then echo "Test was successful, Strings are equal." else echo "Test failed, Strings are not…
Simon Rechermann
  • 467
  • 3
  • 18