cleaned up bashisms
This commit is contained in:
@@ -16,7 +16,7 @@ f2p() {
|
||||
printf '%b' "$cprefix" # always start with the prefix
|
||||
IFS='' # separator
|
||||
while read -r -s -d '' -n1 b; do # convert every byte
|
||||
if [ "$c" == "$l" ]; then # roll over and output suffix+prefix
|
||||
if [ "$c" = "$l" ]; then # roll over and output suffix+prefix
|
||||
c=0 # reinit counter
|
||||
printf '%b' "$csuffix" # end the chunk
|
||||
printf '%b' "$cprefix" # begin a new chunk
|
||||
@@ -36,13 +36,13 @@ f2p() {
|
||||
}
|
||||
|
||||
# main code
|
||||
LF=$'\n' # cache the linefeed character
|
||||
LF="$(printf '\n')" # cache the linefeed character
|
||||
flist='' # pre-build the file list from args
|
||||
dlist='' # pre-build the directory list from args
|
||||
for i; do # iterate over args
|
||||
bname="${i##*/}" # get the basename
|
||||
if [ -d "$i" ]; then # it's a directory, we skip . and ..
|
||||
[ "$bname" == '.' ] || [ "$bname" == '..' ] && continue
|
||||
[ "$bname" = '.' ] || [ "$bname" = '..' ] && continue
|
||||
dlist="${dlist}${i%/}${LF}" # append the directory
|
||||
else # it's a file
|
||||
dname="${i%%$bname}" # get the basedir
|
||||
|
||||
Reference in New Issue
Block a user