[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-bash] Why `echo !(*.l).c` behaves different depending on the conte
From: |
Peng Yu |
Subject: |
[Help-bash] Why `echo !(*.l).c` behaves different depending on the context? |
Date: |
Fri, 8 Feb 2019 22:03:34 -0600 |
Hi,
See below. `echo !(*.l).c` sometimes is OK but sometimes it is an
error. Is it a correct behavior?
$ ls main.c main.l.c
main.c main.l.c
$ cat main.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:
if [[ xx ]]; then
shopt -s nullglob
shopt -s extglob
echo !(*.l).c
fi
$ ./main.sh
./main.sh: line 7: syntax error near unexpected token `('
./main.sh: line 7: ` echo !(*.l).c'
$ cat main.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:
#if [[ xx ]]; then
shopt -s nullglob
shopt -s extglob
echo !(*.l).c
#fi
$ ./main.sh
main.c
--
Regards,
Peng
- [Help-bash] Why `echo !(*.l).c` behaves different depending on the context?,
Peng Yu <=
- Re: [Help-bash] Why `echo !(*.l).c` behaves different depending on the context?, Eduardo Bustamante, 2019/02/08
- Re: [Help-bash] Why `echo !(*.l).c` behaves different depending on the context?, Peng Yu, 2019/02/09
- Re: [Help-bash] Why `echo !(*.l).c` behaves different depending on the context?, Eduardo Bustamante, 2019/02/09
- Re: [Help-bash] Why `echo !(*.l).c` behaves different depending on the context?, Peng Yu, 2019/02/09
- Re: [Help-bash] Why `echo !(*.l).c` behaves different depending on the context?, Peng Yu, 2019/02/09
- Re: [Help-bash] Why `echo !(*.l).c` behaves different depending on the context?, Chet Ramey, 2019/02/11
- Re: [Help-bash] Why `echo !(*.l).c` behaves different depending on the context?, Peng Yu, 2019/02/11
- Re: [Help-bash] Why `echo !(*.l).c` behaves different depending on the context?, Chet Ramey, 2019/02/11
- Re: [Help-bash] Why `echo !(*.l).c` behaves different depending on the context?, Peng Yu, 2019/02/11
- Re: [Help-bash] Why `echo !(*.l).c` behaves different depending on the context?, Chet Ramey, 2019/02/11