Execute a system command: Difference between revisions

From Rosetta Code
Content added Content deleted
(Created task, added C++, Perl, UNIX Shell)
 
(Added language categories.)
Line 4: Line 4:


==[[C plus plus|C++]]==
==[[C plus plus|C++]]==
[[Category:C plus plus]]
'''Compiler:''' [[Visual C plus plus|Visual C++]] 2005
'''Compiler:''' [[Visual C plus plus|Visual C++]] 2005
system("pause");
system("pause");


==[[Perl]]==
==[[Perl]]==
[[Category:Perl]]
Note the use of grave quotes instead of "normal" single quotes.
Note the use of grave quotes instead of "normal" single quotes.
`ls`
`ls`


==[[UNIX Shell]]==
==[[UNIX Shell]]==
[[Category:UNIX Shell]]
UNIX shells are designed to run system commands as a default operation.
UNIX shells are designed to run system commands as a default operation.
ls
ls

Revision as of 02:42, 1 February 2007

Task
Execute a system command
You are encouraged to solve this task according to the task description, using any language you may know.

In this task, the goal is to run either the ls system command, or the pause system command.

C++

Compiler: Visual C++ 2005

system("pause");

Perl

Note the use of grave quotes instead of "normal" single quotes.

`ls`

UNIX Shell

UNIX shells are designed to run system commands as a default operation.

ls

If one wants to capture the command's standard output:

CAPTUREDOUTPUT=$(ls)