pure-sh-bible icon indicating copy to clipboard operation
pure-sh-bible copied to clipboard

📖 A collection of pure POSIX sh alternatives to external processes.

Results 34 pure-sh-bible issues
Sort by recently updated
recently updated
newest added

This leverages string iteration in #17 to truncate a given string to a specified length. ``` shell string_truncate() { string_length_maximum="$1" shift string="$*" string_length=${#string} # if [ "$string_length" -le "$string_length_maximum" ];...

In bash: ``` echo $(( 16#FF )) 255 ``` In pure sh: ``` echo $(( 0xFF )) 255 ```

For usage messages and such in my shell scripts I typically use `prog=${0##*/}` instead of `prog=$(basename $0)`. `dirname` can similarly be replace with `${var%/*}`. You noted the ''#' and '%'...

Not an issue, just more of a compliment. I deal with so many "Linux admins" and "DevOps Engineers" these days. The problem is many of them cannot do (seemingly) basic...

Using `dash` I came across this and thought it may effect you. ``` -L file True if file exists and is a symbolic link. This operator is retained for compatibility...

Set with bash soruce: https://catonmat.net/set-operations-in-unix-shell

We can have the situation that shell options are already unset, in that case we actually change them to setted. The correct way of preventing shell options overriding is using...