Basic CF shell commands

/df

Well-Known Member
In another thread (in fact I think this issue has come up several times), there was the problem that the date command built into the CF can only parse some weird date-time format even though it can generate the standard formats. This led me to check what you actually get if neither the busybox nor the coreutils package is installed.
Code:
for pp in coreutils busybox; do  opkg files $pp | tail -n +2; done | 
    sed 's@^/.*/@@g' | sort -u | 
    while read -r nn _; do [ -e /bin/$nn -o -e /sbin/$nn ] || echo $nn; done
As well as having only the differently functional date command, you don't have these normally expected commands (as well as lots of less expected commands):
Code:
ar
arp
awk
basename
cmp
cpio
diff
dos2unix
ed
false
gzip
head
install
join
less
nohup
nslookup
od
paste
patch
pgrep
pkill
readlink
realpath
sort
stat
strings
tac
tar
telnet
traceroute
true
uname
uniq
unix2dos
unlink
uptime
wc
whoami
xargs
yes
Possibly some commands implemented in CF3.13 busybox were not available in earlier versions? That would extend the list.

od is hexdump -o and less is (mostly) more. Things like true, false, yes can be trivially implemented as shell functions (but true and false are shell builtins in CF busybox ash), while sed can be used to implement head, tac, wc. pgrep is more tricky but can be emulated with a shell function, and similarly basename, uniq and xargs. realpath and readlink are really quite tricky to emulate, especially without stat. stat is irreplaceable.

This post compared the commands provided by the built-in busybox with those from the busybox package.
 
Last edited:
I am not sure what you are proposing?

Is it a new basic-cf package that includes busybox, coreutils and possibly other utilities which would be pre-reqed by webif to provide a reasonably complete unix environment on every humax with the CF so that other package writers and quick utility writers have to worry less about what is different from my system and any potential users system.

i.e. Raise the level of the common playing field to a higher leel
 
The main idea was a quick reference list to help avoid using commands that may not be found on some systems.

There could be a shim shell library that could be sourced to provide what you describe as a higher level, of which this would be an initial version:
Code:
# yes [answer]
# repeatedly send the answer, or "y" if not given
type yes >/dev/null ||
	yes() { # answer
		while true; do 
			echo ${1:-y}
		done
	}
 
Back
Top