echo कमांड
echo आपके computer के लिए एक parrot जैसा है: आप जो भी इसे देते हैं, वह उसे screen पर वापस बोल देता है।
In this page:
Syntax
echo [-n] [-e] "text"
The echo Command
echo text को standard output पर print करता है, optionally एक newline के साथ। यह -n (कोई trailing newline नहीं) और -e (backslash escapes जैसे \n और \t interpret करना) जैसे flags support करता है। एक script से output produce करने का यह सबसे basic तरीका है।
Note:
echo -e उपयोग करें जब आपको \n जैसे escape sequences की ज़रूरत हो जो असल में एक नई line बनाएं।उदाहरण: The echo Command
#!/bin/bash
echo "Hello, Bash!"
echo -n "No newline after this"
echo ""
echo -e "Line1\nLine2\tTabbed"
Login to try C/C++/Java/PHP code in the editor
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
- यह उम्मीद करना कि
echo "a\nb"दो lines print करेगा, जब Bash केechoको\ninterpret करने के लिए-eचाहिए। - एक variable unquoted छोड़ना, जैसे
echo $name, इसलिए spaces और wildcard characters expand हो जाते हैं। - यह भूल जाना कि
echo -n(कोई newline नहीं) एक ही line पर रहने के लिए उपयोग होता है।
🔒
Chapter Quiz — Complete all 12 topics to unlock
0/12 topics done
Complete these topics first: