Skip to content

Instantly share code, notes, and snippets.

@nhed
Created December 22, 2015 17:21
Show Gist options
  • Save nhed/d36ea500986d8fb6211c to your computer and use it in GitHub Desktop.
Save nhed/d36ea500986d8fb6211c to your computer and use it in GitHub Desktop.
# Test for when expression has GLOB characters
$ ls -l
total 8
-rw-r--r-- 1 nhed wheel 0 Dec 21 19:29 a
-rw-r--r-- 1 nhed wheel 0 Dec 21 19:29 b
-rw-r--r-- 1 nhed wheel 0 Dec 21 19:29 c
-rw-r--r-- 1 nhed wheel 0 Dec 21 19:29 d
-rw-r--r-- 1 nhed wheel 2 Dec 21 19:30 x.txt
$ cat x.txt
*
$ IFS=$'\r\n' GLOBIGNORE='*' command eval 'XYZ=($(cat x.txt))'
$ echo "${XYZ[0]}"
*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment