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
0
votes
2 answers

How to evaluate function arguments with for loop

I wan to parse my function arguments with the for loop func() { for arg in $*; do echo "$arg" cone } This works fine if all my arguments are without spaces func "111" "222" "333" But it fails for args with spaces func "111" "222 222"…
MOHAMED
  • 41,599
  • 58
  • 163
  • 268
0
votes
1 answer

ASH Make Variable Name Out Of Two Variables

So I am making a script that allows you to input a number, export it, and then import it and use it in a loop. Here's what I mean: read NumberOfVMs "How many do you want? " echo $NumberOfVMs > /variables/NumberOfVMs Then later; while [ $NumberOfVMs…
Crutchcorn
  • 199
  • 5
  • 14
0
votes
0 answers

Cygwin Heap Space Error

I'm receiving an error when I try to run any cygwin functionality (bash/sh/ash/dash), which says: 1 [main] ash 5008 D:\DevStudio\cygwin\bin\ash.exe: *** fatal error - could n't allocate heap, Win32 error 487, base 0xC80000, top 0xCD0000,…
CoD
  • 53
  • 5
0
votes
2 answers

busybox ash via paramiko not emitting prompt on stdout

I created Python GUI that takes a list of commands as input and executes the list through a Telnet or SSH session. While opening a SSH session (using Paramiko in Python) I run commands on various devices using this code in a for loop: …
Evan
  • 65
  • 6
0
votes
1 answer

Can't increment a 0-padded number past 8 in busybox sh

this is the code I am using to save files from a camera and name them from 0001 onward. The camera is running Busybox, and it has an ash shell inside. The code is based on a previous answer by Charles Duffy here. #!/bin/sh …
Rick
  • 45
  • 9
0
votes
1 answer

why ash shift command cause whole script exit?

I have a script test.sh: OUTPUT_FILE="$1"; shift || { echo "require arg1: output file path"; exit 1; } But when i execute ./test.sh without arguments, it does not output require arg1: output file path The output is shift: nothing to shift Who can…
osexp2000
  • 2,910
  • 30
  • 29
0
votes
4 answers

How to make the input file of my program start from the 3rd line?

I have a program that reads data from a file in this way root@root# myprogram < inputfile.txt Now I want my program to read the input file from the 3rd line and not from the beginning of the file. I have to use < inputfile.txt. I can not call with…
MOHAMED
  • 41,599
  • 58
  • 163
  • 268
0
votes
0 answers

How to detect a ssh command failure due to a non bash shell on the remote machine?

It seems that this question needs some explanations. Current I wrote a ssh wrapper bash function that is starting or restoring tmux sessions on the remote hosts. It's presence is totally transparent to the user, you just type ssh host and because…
sorin
  • 161,544
  • 178
  • 535
  • 806
0
votes
2 answers

How to make filter on an output based on string lines?

I have the following output $ mycommand 1=aaa 1=eee 12=cccc 15=bbb And I have a string str containing: eee cccc and I want to display only lines which contains string exist in the string lines So my out put will be: $ mycommand |…
MOHAMED
  • 41,599
  • 58
  • 163
  • 268
0
votes
1 answer

Using the ash shell "for x in y"

First, bash is not installed on the system I am using. So, no bash based answers please. Ash does not do ifs with Regexes. In an ash shell script I have a list of acceptable responses: # NB: IFS = the default IFS = # 802.11…
Wes Miller
  • 2,191
  • 2
  • 38
  • 64
0
votes
1 answer

regexp error when filtering command output

I want to filter the lines from the following command: $ cat /proc/net/route Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT br-lan 01020300 C0A80101…
MOHAMED
  • 41,599
  • 58
  • 163
  • 268
0
votes
3 answers

How to use the output of a command as an input to other program in linux?

I have a program running on linux This program take its input from the stdin So I can launch it with input file in this way myprogram < file in order to avoid typing input to the program Now I want that the program take the input from a command…
MOHAMED
  • 41,599
  • 58
  • 163
  • 268
0
votes
1 answer

How to POST data to php from ash (bash)

I have url (www.blabla.web.id/proses_data.php) online. And I want to submit data to that url from my bash script. I'm using ash, bash inside OpenWRT. I'm trying this technique, #!/bin/sh elinks -dump…
rezafahlevi08
  • 347
  • 1
  • 5
  • 10
0
votes
1 answer

bash and ash shell returns different error message for same command

I'm using ash and bash shell in my embedded system, I got following error messages for same command using both shell For ash shell $ kill -9 sh: you need to specify whom to kill For bash shell $ kill -9 kill: usage: kill [-s sigspec | -n signum |…
Rahul R Dhobi
  • 5,668
  • 1
  • 29
  • 38
0
votes
1 answer

How to send stderr in email shell script (ash)

I wrote a shell script that I use under ash, and I redirect stderr and stdout to a log file. I would like that log file to be emailed to me only if stderr is not empty. I tried: exec >mylog.log 2>&1 # Perform various find commands if…