24.12.2012 Views

CSC322 C Programming and UNIX - Department of Computer ...

CSC322 C Programming and UNIX - Department of Computer ...

CSC322 C Programming and UNIX - Department of Computer ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>UNIX</strong> User Comm<strong>and</strong>s: echo <strong>and</strong> touch<br />

echo . . . prints its arguments to the screen<br />

– echo is <strong>of</strong>ten a shell built-in comm<strong>and</strong>. To guarantee the behavior described<br />

in the man-page, use /bin/echo<br />

– Example:<br />

[schulz@gettysburg ∼]$ echo ”Hello World”<br />

Hello World (simplest ”Hello World” program in <strong>UNIX</strong>)<br />

[schulz@gettysburg ∼]$ echo ’$PATH = ’ $PATH<br />

$PATH = .:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/us<br />

r/java/jdk1.3.1 01/bin:/home/graph/schulz/bin:/usr/X11R6/bin<br />

touch . . . sets the access <strong>and</strong> modification time <strong>of</strong> the given files to<br />

the current time<br />

– If one <strong>of</strong> the files does not exist, touch will create an empty file <strong>of</strong> that name<br />

– Important option:<br />

∗ -c: Do not create non-existing files (long form --no-create is supported by<br />

modern implementations (GNU))<br />

∗ Other options: man touch<br />

Stephan Schulz 42

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!