Aliases spawning with BSD flags when BSD_MODE is set 'false' #2

Closed
opened 7 years ago by ajohnson · 4 comments
Owner

ajohnson@helios:~/git/zsh [master]% grep BSD_MODE zsh.conf

BSD_MODE=false #Some options must be specified differently in BSD

ajohnson@helios:~/git/zsh [master]% alias ll

ll='ls -lGh'

(-G is a BSD flag for coloured output)

`ajohnson@helios:~/git/zsh [master]% grep BSD_MODE zsh.conf` `BSD_MODE=false #Some options must be specified differently in BSD` `ajohnson@helios:~/git/zsh [master]% alias ll` `ll='ls -lGh'` (-G is a BSD flag for coloured output)
ajohnson self-assigned this 7 years ago
ajohnson started working 7 years ago
Poster
Owner

Setting SYNTAX_HIGHLIGHT 'false' leaves this feature enabled as well. Looks like the problem is in how the variable is tested. They always appear to be "true."

Setting SYNTAX_HIGHLIGHT 'false' leaves this feature enabled as well. Looks like the problem is in how the variable is tested. They always appear to be "true."
Poster
Owner

Making changes in branch iss2

Making changes in branch iss2
Poster
Owner

After some research, I don't like the way booleans are handled. Making a change to compare true/false as strings instead.

Explanation for future reference:
if $BSD_MODE; then
//do things
fi

This would work because $BSD_MODE may be set to true, and the script will run true as a command, and this will evaluate as such to do the things. This is how the built-in booleans work.

Changing to string comparison, because under this model, you can set:
BSD_MODE=reboot

Suddenly, every time your shell starts, your system would reboot as it tries to evaluate the variable.

After some research, I don't like the way booleans are handled. Making a change to compare true/false as strings instead. Explanation for future reference: ```if $BSD_MODE; then``` ```//do things``` ```fi``` This would work because `$BSD_MODE` may be set to true, and the script will run `true` as a command, and this will evaluate as such to do the things. This is how the built-in booleans work. Changing to string comparison, because under this model, you can set: `BSD_MODE=reboot` Suddenly, every time your shell starts, your system would reboot as it tries to evaluate the variable.
ajohnson stopped working 7 years ago
22min 14s
Poster
Owner

Fixed:
Pull request #3

Commit: ea674d3c24

Fixed: Pull request https://git.skyfall.tech/ajohnson/zsh/pulls/3 Commit: ea674d3c24
ajohnson closed this issue 7 years ago
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Total Time Spent: 22 minutes 14 seconds
ajohnson
22 minutes 14 seconds
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: ajohnson/zsh#2
Loading…
There is no content yet.