Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.36 KB | None | 0 0
  1. #!/bin/dash
  2.  
  3. busybox_has() {
  4.    builtin command -v busybox >/dev/null ||
  5.       return 1
  6.    
  7.    # Sanitize searches for '[' and '[['
  8.    a=$1
  9.    a=${a//[/\\[}
  10.    
  11.    if [[ "$1" = "[" ]]; then
  12.       busybox | egrep -oq $'\t'"($a)[,[:space:]]" ||
  13.          return 1
  14.    else
  15.       busybox | egrep -oq "[[:space:]]($a)[,]?" ||
  16.          return 1      
  17.    fi
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement