Sunday, May 19, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 426  / 1 Year ago, tue, january 10, 2023, 3:12:21

I want to define this function:



displayInfo (){ echo "Hi";cal;date }


But after pressing enter, this is what I see:



>


What's the problem?


More From » command-line

 Answers
3

When you're defining a function on a single line, you need a ; to signify the end of the commands:



displayInfo (){ echo "Hi";cal;date; }


Alternatively, you can do it on multiple lines:



displayInfo (){ 
echo "Hi"
cal
date
}

[#4895] Tuesday, January 10, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
nnaisdio

Total Points: 369
Total Questions: 112
Total Answers: 108

Location: Kenya
Member since Mon, Jun 14, 2021
3 Years ago
;