Questions tagged [ash]

The Almquist shell is a variant of the Bourne shell. Its most famous forks ares busybox ash and dash.

The Almquist shell is a variant of the . Its most famous forks ares ash and .

61 questions
50
votes
3 answers

Ash profile/configuration file

I am looking for a way to customize Ash sessions with my own sets of aliases and whatnots. What is the Ash equivalent of Bash's bashrc files?
reg
  • 1,113
  • 1
  • 8
  • 12
37
votes
1 answer

Avoiding "BASH-isms" in shell scripts

Does there exist a tool similar to Perl::Critic that will inspect your shell scripts and point out flaws, portability issues, uses of non-standard programs without fallbacks, depreciated program uses, etc? I realize that set -o posix will disable…
amphetamachine
  • 5,388
  • 2
  • 34
  • 41
28
votes
2 answers

Are dash, ash and sh script 100% compatible?

I wanted to know whether scripts written for dash, ash, and sh are 100% compatible? Are there any added features to dash or ash, or syntax change? From what I heard, ash is a direct descendant of sh.
user1115057
  • 795
  • 3
  • 12
  • 17
23
votes
4 answers

How to port to bash-style arrays to ash?

Some time ago I have written a bash script which now should be able to run in environment with ash. In bash it was like : services=( "service1.service" "service2.service" …
metamorphling
  • 522
  • 1
  • 3
  • 11
21
votes
5 answers

Set environment variable for subshell

I know that I can run a command with an environment variable like this: FOO=bar mycommand I know that I can run commands in a subshell like this: (firstcommand && secondcommand) But can I somehow combine those two? FOO=bar (firstcommand &&…
AndreKR
  • 1,010
  • 3
  • 13
  • 28
16
votes
1 answer

Percent in $PATH environment variable

My $PATH looks like…
user877329
  • 721
  • 5
  • 22
10
votes
3 answers

RegExp testing with ash shell (BusyBox)

I need to do a RegExp pattern test on a certain bit of user input. This is the pattern I need to test the value against. ^([a-z]{2,3})\-([a-z][a-z]*[0-9]*)\-(\d+)$ An example match would be: na-examplename-01 The shell I have available is BusyBox…
James White
  • 645
  • 2
  • 7
  • 22
8
votes
1 answer

How to persist environment variables in ash, the Almquist shell?

How can I get ash to load some environment variables on startup? Just put them in /etc/profile /etc/profile is only read for login shells; what about non-login shells, as frequently pop up when working with docker (which uses…
DJV
  • 81
  • 1
  • 2
8
votes
0 answers

Accessing regular linux commands in Huawei's Dopra Linux

Backstory: I have a Huawei HG8245 router in my house and I want to change the default username/password. I've tried following this guide but the config file always gets reset. My ISP isn't helping either so I'm looking for other ways to accomplish…
Dzeri96
  • 111
  • 2
  • 5
6
votes
2 answers

urlencode function

I need a way to URL encode strings with a shell script on a OpenWRT device running old version of busybox. Right now I ended up with the following code: urlencode() { echo "$@" | awk -v ORS="" '{ gsub(/./,"&\n") ; print }' | while read l do …
Serg
  • 63
  • 1
  • 3
5
votes
2 answers

What is the difference between `ash` and `sh` shell on Linux?

I am new to a lot of tools on Linux. A quick search did not help, I only got more about bash or sh, and searching for it somehow leans towards bash in the search results. There are quite a few different shell types out there, I have even seen zsh,…
questionto42
  • 405
  • 1
  • 4
  • 12
5
votes
3 answers

What one should check when re writing bash conditions for sh or ash?

Sometime, it is not possible to have the luxury of bash on a system, but conditions are easier to make on bash compared to sh or ash, what one should verify to ensure condition won't break with typical "unexpected operator" when rewriting from bash…
Zulgrib
  • 914
  • 2
  • 8
  • 24
5
votes
1 answer

History in the Almquist shell in the NetBSD

In NetBSD /bin/sh is a modified version of the Almquist shell. With the command fc -l it is possible to view the last 16 commands typed in the prompt in the current session and not the older ones. The environment variable HISTSIZE is set at 1000 and…
BowPark
  • 4,811
  • 12
  • 47
  • 74
5
votes
1 answer

Number comparisons in BusyBox ash

I have the following script that extracts data from the EXIF command on my busybox ash-based system. I parse the date tag from the end of the file and use case as a final check to ensure the format is correct. My problem is the if statement at the…
Wags
  • 317
  • 3
  • 10
4
votes
1 answer

Where is the PS1 prompt variable set in ash shell?

I have a NAS drive from Western Digital. I can ssh into it, and when I log in, the first line that appears is: BusyBox v1.20.2 (2014-10-30 15:28:59 CST) built-in shell (ash) I don't like the default prompt that I get (echo $PS1 gives \u@\h \W \$).…
osullic
  • 235
  • 1
  • 8
1
2 3 4 5