[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Why won't set -v work?
From: |
DJ Mills |
Subject: |
Re: [Help-bash] Why won't set -v work? |
Date: |
Thu, 15 Mar 2012 11:06:25 -0400 |
On Thu, Mar 15, 2012 at 10:18 AM, Bill Gradwohl <address@hidden> wrote:
> I'm experimenting and came up with something I can't explain.
>
> #!/bin/bash
> declare parm='pass1'
> #case "${parm}" in
> # 'pass1')
> set -v
> if true; then echo True; fi
> # ;;
> # *)
> # echo Hello
> # ;;
> #esac
>
> When executed, the above works as expected.
>
> If you remove the octothorpes to activate the case statement and run it
> again, the set -v appears non functional.
>
> Why?
>
> Thank You
>
> --
> Bill Gradwohl
>
My guess would be that set -v works the same way shopt -s extglob
does, and actually changes the way bash parses commands.
Since bash parses compound commands at once (yes, that's the entire
case statement), the set -v won't actually take effect until after you
exit that command. Same for setting it within a function, if
statement, loop, etc.
- Re: [Help-bash] Why won't set -v work?, (continued)
- Re: [Help-bash] Why won't set -v work?, Greg Wooledge, 2012/03/15
- Re: [Help-bash] Why won't set -v work?, Bill Gradwohl, 2012/03/15
- Re: [Help-bash] Why won't set -v work?, Greg Wooledge, 2012/03/15
- Re: [Help-bash] Why won't set -v work?, Bill Gradwohl, 2012/03/15
- Re: [Help-bash] Why won't set -v work?, Steven W. Orr, 2012/03/16
- Re: [Help-bash] Why won't set -v work?, Bill Gradwohl, 2012/03/16
- Re: [Help-bash] Why won't set -v work?, Steven W. Orr, 2012/03/16
- Re: [Help-bash] Why won't set -v work?, Chet Ramey, 2012/03/15
Re: [Help-bash] Why won't set -v work?, Bill Gradwohl, 2012/03/15
Re: [Help-bash] Why won't set -v work?,
DJ Mills <=