Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  **
is not "expanded to all files and directories in the children directories, with a depth limit of 1." It's hard to see using `ls` because `ls` doesn't just list its arguments, it also lists files inside its directory arguments. Use

  echo **
and you'll see it just expands to the same as

  *
- all the files in the current directory. Or type

  **
and press Ctrl-x, Ctrl-* (glob-expand-word) to expand it.

After `shopt -s globstar`

  **
expands to all files recursively.

Also, `echo $dir | tr '[:lower:]' '[:upper:]'` should be `printf '%s' "$dir" | tr '[:lower:]' '[:upper:]'` to handle spaces and other weirdness in file names.

(If anyone knows how to escape asterisks in HN it would be helpful to know :)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: