Ihe atụ 15 bara uru nke iwu 'echo' na Linux
Iwu echo bụ otu n'ime iwu arụnyere n'ime Linux bash na C shells, nke a na-ejikarị n'asụsụ scripting na faịlụ batch iji gosipụta ahịrị ederede/eriri na mmepụta ọkọlọtọ ma ọ bụ faịlụ.
Ihe syntax maka iwu echo bụ:
echo [option(s)] [string(s)]
1. Tinye ahịrị ederede ma gosipụta ya na mmepụta ọkọlọtọ
$ echo Tecmint is a community of Linux Nerds
Wepụta ederede a:
Tecmint is a community of Linux Nerds
2. Kwupụta mgbanwe wee kwughachi uru ya. Dịka ọmụmaatụ, Kwupụta mgbanwe nke x wee kenye uru ya =10.
$ x=10
kwughachi uru ya:
$ echo The value of variable x = $x The value of variable x = 10
Mara: Nhọrọ '-e' dị na Linux na-arụ ọrụ dị ka nkọwa nke mkpụrụedemede agbanarị agbagoro azụ.
3. Iji nhọrọ '' '' - backspace with backslash ntụgharị '-e' nke na-ewepụ oghere niile dị n'etiti.
$ echo -e "Tecmint \bis \ba \bcommunity \bof \bLinux \bNerds" TecmintisacommunityofLinuxNerds
4. Iji nhọrọ ' '- Ahịrị ọhụrụ nwere onye ntụgharị okwu azụ '-e' na-agwọ ahịrị ọhụrụ site na ebe ejiri ya.
$ echo -e "Tecmint \nis \na \ncommunity \nof \nLinux \nNerds" Tecmint is a community of Linux Nerds
5. Iji nhọrọ '' '' - kehoraizin taabụ na backspace ntụgharị '-e' nwere kehoraizin taabụ oghere.
$ echo -e "Tecmint \tis \ta \tcommunity \tof \tLinux \tNerds" Tecmint is a community of Linux Nerds
6. Olee maka iji nhọrọ ọhụrụ Line ' 'na horizontal tab'' n'out oge.
$ echo -e "\n\tTecmint \n\tis \n\ta \n\tcommunity \n\tof \n\tLinux \n\tNerds" Tecmint is a community of Linux Nerds
7. Iji nhọrọ '' '' - vetikal tab na backspace ntụgharị '-e' inwe oghere taabụ vetikal.
$ echo -e "\vTecmint \vis \va \vcommunity \vof \vLinux \vNerds" Tecmint is a community of Linux Nerds
8. Olee maka iji nhọrọ ọhụrụ Line ' ' na vetikal tab '' n'out oge.
$ echo -e "\n\vTecmint \n\vis \n\va \n\vcommunity \n\vof \n\vLinux \n\vNerds" Tecmint is a community of Linux Nerds
Mara: Anyị nwere ike okpukpu abụọ taabụ vetikal, taabụ kwụ ọtọ na oghere ahịrị ọhụrụ site na iji nhọrọ ugboro abụọ ma ọ bụ ugboro ole achọrọ.
9. Iji nhọrọ ' '- nlaghachị ụgbọ ala ya na onye ntụgharị okwu azụ '-e' ka o nwetala nkwụghachi ụgbọ ala akọwapụtara na mmepụta.
$ echo -e "Tecmint \ris a community of Linux Nerds" is a community of Linux Nerds
10. Iji nhọrọ & # 8216
$ echo -e "Tecmint is a community \cof Linux Nerds" Tecmint is a community [email :~$
11. Omit echoing trailing ọhụrụ akara iji nhọrọ '-n'.
$ echo -n "Tecmint is a community of Linux Nerds" Tecmint is a community of Linux [email :~/Documents$
12. Iji nhọrọ ''--alọghachite anya na onye ntụgharị okwu azụ azụ'-e' iji nwee njikere ụda.
$ echo -e "Tecmint is a community of \aLinux Nerds" Tecmint is a community of Linux Nerds
Mara: Gbaa mbọ hụ na ịlele igodo olu, tupu agbapụ.
13. Bipụta faịlụ/nchekwa niile site na iji iwu echo (ls Command alternative).
$ echo * 103.odt 103.pdf 104.odt 104.pdf 105.odt 105.pdf 106.odt 106.pdf 107.odt 107.pdf 108a.odt 108.odt 108.pdf 109.odt 109.pdf 110b.odt 110.odt 110.pdf 111.odt 111.pdf 112.odt 112.pdf 113.odt linux-headers-3.16.0-customkernel_1_amd64.deb linux-image-3.16.0-customkernel_1_amd64.deb network.jpeg
14. Bipụta faịlụ nke otu ụdị. Dịka ọmụmaatụ, ka anyị were na ịchọrọ ibipụta faịlụ '.jpeg' niile, jiri iwu na-esonụ.
$ echo *.jpeg network.jpeg
15. Enwere ike iji nkwughachi ahụ na onye na-arụ ọrụ redirect iji wepụta faịlụ na ọ bụghị mmepụta ọkọlọtọ.
$ echo "Test Page" > testpage ## Check Content [email :~$ cat testpage Test Page
Nke ahụ bụ maka ugbu a ma echefula ịnye anyị nzaghachi gị bara uru na nkọwa ndị dị n'okpuru.