Unable to change the case of a letter in Zsh

The code in my Zsh

#!/bin/zsh
q=$1

open "http://mathworld.wolfram.com/$q.html"

I put the input to the app

triangle

I get an error at Wolfram, since the first letter must be a big one.

How can you change the case for the first letter in the variable q?

Upvotes: 0

Views: 160

Answers (1)

viam0Zah
viam0Zah

Reputation: 26312

# q=triangle
# echo ${(C)q}
Triangle

See Parameter Expansion Flags.

Upvotes: 2

Related Questions