For faster navigation, this Iframe is preloading the Wikiwand page for echo.

echo

Матеріал з Вікіпедії — вільної енциклопедії.

echo (англ. Echo — луна) — команда в DOS, OS/2, Microsoft Windows, Unix і Unix-подібних операційних системах, яка виводить рядок тексту на комп'ютерний термінал. Це зазвичай використовується в сценаріях оболонок і командних файлах для виводу тексту про стан скрипту на екран або у файл.

Приклад використання

[ред. | ред. код]
$ echo This is a test.
This is a test.
$ echo "This is a test." > ./test.txt
$ cat ./test.txt
This is a test.
$ echo $PATH 
/usr/lib/qt-3.3/bin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/g98/bsd:
/usr/local/g98/local:/usr/local/g98/extras:/usr/local/g98:/usr/local/g98/bsd:/usr/local/g98/local:
/usr/local/g98/extras:/usr/local/g98

Деякі з варіантів Unix або окремі оболонки підтримують додаткові опції, як наприклад -n (не виводить кінцевий символ нового рядка) чи -e (дає вказівку інтерпретувати escape-послідовності). Проте вони не включені в стандарт[1] через історичну несумісність між BSD і System V; в ситуаціях де це проблема може використовуватися команда printf.

Приклад реалізації

[ред. | ред. код]

Команда echo може реалізована на мові програмування C лише кількома рядками коду:

#include <stdio.h>
/* echo command-line arguments; 1st version */
int main(int argc, char *argv[])
{
  int i;
  for (i = 1; i < argc; i++)
    printf("%s%s", argv[i], (i < argc-1) ? " " : "");
  printf("\n");
  return 0;
}

Виноски

[ред. | ред. код]
  1. IEEE Std 1003.1, 2004, documentation for echo. Архів оригіналу за 1 квітня 2010. Процитовано 9 листопада 2008.

Посилання

[ред. | ред. код]
{{bottomLinkPreText}} {{bottomLinkText}}
echo
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?