Skip to content

Modified the behavior of assignment to not modify the status code.#1

Open
gtnoble wants to merge 1 commit intooliwer:masterfrom
gtnoble:master
Open

Modified the behavior of assignment to not modify the status code.#1
gtnoble wants to merge 1 commit intooliwer:masterfrom
gtnoble:master

Conversation

@gtnoble
Copy link
Copy Markdown

@gtnoble gtnoble commented Jun 5, 2023

This is consistent with the behavior of bash/POSIX shell.
Before, it was impossible (to me) to get the status code when making an assignment from a command substitution.

Now you can have really neat C-like code like this:

if ( response=`{make-http-request $url} ) {
        echo $response
} else {
        echo 'an error occurred' >[1=2]
        echo $response
}

This is consistent with the behavior of bash/POSIX shell
Before, it was impossible (to me) to get the status code when making an
assigment from a command substitution.

Now you can have really neat C-like code like this:

if ( response=`{make-http-request $url} ) {
        echo $response
} else {
        echo 'an error occurred' >[1=2]
        echo $response
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant