Skip to content

Conversation

@dagguh
Copy link
Contributor

@dagguh dagguh commented May 14, 2021

No description provided.

@dagguh dagguh requested a review from a team as a code owner May 14, 2021 13:53
trap 'echo "got interrupted"' INT
for i in {1..10}
do
echo "sleeping ${'$'}i..."
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this substitution, what is it supposed to do?

Copy link
Contributor Author

@dagguh dagguh May 14, 2021

Choose a reason for hiding this comment

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

${'$'} is a way to print a literal $ within a multiline string literal """.
Otherwise it'd be $i and there's no Kotlin i here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I tested it on Bash and ZSH and in both cases I got "bad substitution" error.

Copy link
Contributor Author

@dagguh dagguh May 14, 2021

Choose a reason for hiding this comment

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

Try $i in Bash/ZSH. Or run/debug the JUnit test
Here's the Bash version:

trap 'echo "got interrupted"' INT
for i in {1..10}
do
    echo "sleeping $i..."
    sleep 1
done  

You can try ctrl-C while it loops

Copy link
Contributor

Choose a reason for hiding this comment

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

OMG, brain fog. It' a Kotlin substitution 🤦 . Ignore me :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you want to restore your bash session to normal, you can clear the trap via trap - INT

@dagguh dagguh enabled auto-merge (rebase) May 14, 2021 14:36
@dagguh
Copy link
Contributor Author

dagguh commented May 14, 2021

CI is green on my fork.
The PR CI times out (ironic) even after reruns. I'll force-push it to generate a new commit hash.

@dagguh
Copy link
Contributor Author

dagguh commented May 14, 2021

It got cancelled again. I guess I'll retry later

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.

2 participants