The Almquist shell is a variant of the [tag:bourne-shell]. Its most famous forks ares [tag:busybox] ash and [tag:dash].

learn more… | top users | synonyms

1
vote
1answer
59 views

How do I find and list folders with a specific folder name, containing files modified recently?

I have a set of folders that are regularly updated, which I would like to regularly parse through and update to a simple text file list. This list gets used with rsync so I shorten the file names ...
-1
votes
2answers
112 views

Where to find the source code for the Almquist Shell?

I'm learning the Unix shell command language looking for a repository that contains the source code for the Almquist shell ("ash" / "dash") but I could not find it. Can you help me find the source? I'...
1
vote
1answer
33 views

Busybox ASH inside initrd has a problem when piping tee to sed

I'm trying to log the early boot output from the init script. This is what is working: mkdir -p /run/log && \ mkdir -p /tmp && \ mkfifo /tmp/stage-1-init.log.fifo1 && \ mkfifo ...
0
votes
0answers
12 views

in sh script , what is the - sign for after a variable name? [duplicate]

$mtdnum is a string, could be null string. What is the - for? if [[ -z ${mtdnum-} ]]; then echo "Could not find it" return 1 fi
1
vote
2answers
364 views

Automatically entering ssh password from Busybox terminal

I currently am attempting to reboot a modem via ssh using a bash script. For reasons I don't feel like explaining, I NEED to start on an ubuntu server computer, ssh into a setup running busybox 1.21.1 ...
3
votes
1answer
295 views

Start sh in a specified directory from inittab

I am currently working on an embedded Linux system. For it to be similar to our other products I need to have it start a shell in a specified directory on boot, accessible using the serial port. For ...
0
votes
1answer
86 views

Checking the schedule of a cronjob and doing a conditional check on specific parts

Edit: I managed to solve this myself, I actually deleted my original question as I was over complicating the process slightly, but have since answered it in case others find it useful. RegExp is not ...
4
votes
3answers
1k views

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-...
0
votes
6answers
318 views

How can I filter out a specific part of a JSON response in ash shell

I'm using wget with -qO to a specific updater URL for OpenELEC which provides the following JSON response, similar to the one below. {"data":{"update":"OpenELEC-RPi2.arm-5.0.8.tar","folder":"releases"...
0
votes
2answers
432 views

ffmpeg batch convert .avi to .mp4 - in ash

I'm looking to batch-convert a directory (or several) of video files from .avi to .mp4 containers, just copying the video and audio streams across. I know the ffmpeg command to do this, and have no ...
5
votes
1answer
1k views

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?
3
votes
1answer
693 views

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. ...
15
votes
1answer
747 views

Percent in $PATH environment variable

My $PATH looks like this: /home/torbjorr/deployed/vector/x86_64-GNU%2fLinux:/home/torbjorr/deployed/typewriter/x86_64-GNU%2fLinux:/home/torbjorr/deployed/mustudio/x86_64-GNU%2fLinux:/home/torbjorr/...
2
votes
1answer
647 views

Regex doesn't work with grep

I have a string like this TEST="/dev/sda1 on /media/sda1 type vfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,quiet)" (Result from mount | grep sda1) ...
0
votes
1answer
2k views

How to write simple if condition in ash?

I would like to write a small script that would check every once in a while if I have the internet connection. I would like to run it in crontab on my router where I have ash. I am having a hard ...
4
votes
0answers
920 views

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 ...
2
votes
2answers
2k views

Busybox ash script does not exit cleanly after executing cat; unable to get exit code

Consider the following script wrapcat.sh (a wrapper for cat) for illustrative purposes. It is run with busybox (ash) in an embedded Linux 2.6 box. #!/bin/sh cat $1 Under certain circumstances, this ...
2
votes
1answer
3k views

Using BASH versus ASH on Synology

The majority of my photo files have the following naming convention / format IMG_20131204_120000.JPG, showing date and time the photo was taken (iPhone/Apple naming convention). However, not all my ...
3
votes
1answer
989 views

Need to improve 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="" '{ ...
10
votes
2answers
3k views

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....
0
votes
2answers
4k views

Why does this incrementing for loop return a bad variable?

I'm trying to call this shell script from within the CLI of GRASS GIS: for (( day=5; day<367; day+5 )); do # commands that I've tested without a loop. done exit 0 returns Syntax error: Bad ...
32
votes
1answer
1k views

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