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
2
votes
1 answer

Busybox: emulate line editing for read shell's built-in

I need to develop a simple text interface for an embedded system with more or less only the Busybox installed on it. For my purposes the read shell built-in would have sufficed. But the Busybox ash (or any other shell, they use the same code for the…
Dummy00001
  • 14,958
  • 5
  • 32
  • 56
2
votes
2 answers

Assign job count number to variable (POSIX-Shell)

Opening 3 jobs in ash with i.e. sh & sh & sh & and counting this jobs with i.e. jobs -p | wc -l shows 3 which is OK. But trying to assign this job count to a variable with JOBNR=$(jobs -p | wc -l) and printing this variable with echo…
deetee
  • 65
  • 7
2
votes
1 answer

Provision with Vagrant on a box that uses Busybox

When I try provisioning on my Freifunk gluon node like I do it on my other debian machines: Vagrant.configure("2") do |config| config.vm.provision "shell", path: "bootstrap-node.sh" end Then I get the error: The configured shell…
rubo77
  • 15,234
  • 23
  • 111
  • 195
2
votes
2 answers

Break from imbricated for loop

I want to know if there is a way to leave imbricated for loop: check_mac_address() { local mac="$1" for wunit in `get_wunit`; do for iuc in `get_iuc`; do for assoc_mac in `get_iuc $wunit $iuc`;do …
stack_A
  • 653
  • 4
  • 11
  • 19
2
votes
2 answers

how to put all command arguments in one variable

I want to execute a shell script that require 3 arguments. The argument number 2 contains a string with space I want to put all arguments in one variable like this: Linux:~# kk="\"111\" \"222 222\" \"333\"" Linux:~# echo $kk "111" "222 222"…
MOHAMED
  • 35,883
  • 48
  • 140
  • 238
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
  • 35,883
  • 48
  • 140
  • 238
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,326
  • 2
  • 13
  • 25
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,301
  • 7
  • 37
  • 62
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
  • 35,883
  • 48
  • 140
  • 238
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
  • 2,852
  • 3
  • 25
  • 44
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,103
  • 5
  • 34
  • 50
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
  • 35,883
  • 48
  • 140
  • 238
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
  • 3,976
  • 2
  • 34
  • 68
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…
1 2
3
11 12