Skip to content
This repository was archived by the owner on Sep 1, 2019. It is now read-only.

Proper shell quoting#2

Open
AlexDaniel wants to merge 1 commit into
stmuk:masterfrom
AlexDaniel:master
Open

Proper shell quoting#2
AlexDaniel wants to merge 1 commit into
stmuk:masterfrom
AlexDaniel:master

Conversation

@AlexDaniel

Copy link
Copy Markdown

To support any paths that contain spaces or start with -. Also,
removes nonsensical use of ${} because it does nothing anyway.

To support any paths that contain spaces or start with -. Also,
removes nonsensical use of ${} because it does nothing anyway.
@AlexDaniel AlexDaniel changed the title [WIP] Proper shell quoting Proper shell quoting Jan 24, 2018
@AlexDaniel

Copy link
Copy Markdown
Author

This is probably good to go. I haven't tested it so someone else will probably need to confirm that nothing is broken.

@stmuk

stmuk commented Jan 24, 2018

Copy link
Copy Markdown
Owner

Not very keen on merging if we don't know it works. I also prefer ${} as less ambiguous in some cases.

I'll use your PR to finish quoting the bash variables anyway so thanks for that

Comment thread rakudup
# https://github.com/stmuk/rakudup

RAKUDO_ROOT="${HOME}/.rakudup"
RAKUDO_ROOT=$HOME/.rakudup

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove "" here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need really, just for consistency with the other line below.

Comment thread rakudup
then
set -x
if [[ $DEBUG ]]; then
set -x

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks DEBUG=0

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You sure it does?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I think it would have to be [ $DEBUG ] since [[ 0 ]] is [ "0" ] which is true.

I now remember why I use Perl! grrrr

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEBUG=0
if [[ $DEBUG ]]; then echo foo; fi       # foo
if [ ! -z "$DEBUG" ]; then echo bar; fi  # bar

Looks identical to me

Comment thread rakudup
cd ${RAKUDO_SRC}
echo "Building Rakudo ${RELEASE}. This will take several minutes on a modern CPU."
echo "'tail -f ${RAKUDO_SRC}/build.log' for progress"
cd -- "$RAKUDO_SRC" || exit 1

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add the exit but don't care about the case where directory starts with dash! (Although it is interesting!)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What? But that's the whole point…

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants