0% found this document useful (0 votes)
2 views2 pages

Bash expr Function: Math & Strings

Uploaded by

ni875090
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Bash expr Function: Math & Strings

Uploaded by

ni875090
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Bash Function Guide: expr

Description: Performs mathematical calculations or string operations.

Syntax: expr EXPRESSION

Usage: Use expr when you want to calculate values inside Bash scripts.
Examples for expr
# Arithmetic a=5 b=3 echo $(expr $a + $b) # Output: 8 # String length str="Bash"
echo $(expr length "$str") # Output: 4

You might also like