pwd
in winxp del *.* /Q /S
to get the current shell :echo $0also Use the command ps with -p {pid} option, which selects the processes whose process ID numbers appear in pid. Use following command to find out what shell you are in:ps -p $$
A basic shell program should essentially emulate a command prompt with a very limited set of commands, such as exit to close the shell and possibly cd to change the current directory. Shell's are typically used to spawn other processes, but a basic shell will typically limit which processes may be allowed to run.
# shell script example if [ -f $1 ]; then echo $1 is a file elsif [ -d $1 ]; then echo $1 is a directory fi
see : Write_a_shell_program_using_the_if-the-else_to_test_whether_a_variable_name_is_a_directory_or_a_file
That's what cp(1) program is good for: cp this that "something else" /dir/to/
echo 'print 24*60*60,"\n"' | bcorecho '86400'
The following simple shell command lists the contents of a directory (verbose), and redirects the output to 'newfile.txt': ls -l > newfile.txt See related links.
for i in * do if [ -d $i ]; then echo $i directory >> /tmp/directories fi done
To run a system program in C using the system() function, you first need to include the stdlib.h header. You can then call system("command"), replacing "command" with the shell command you want to execute. For example, system("ls") will list the files in the current directory. Compile your program with a C compiler (like gcc), and then execute the compiled binary to run the command.
If you are asking about a shell script, just create a text file with the commands you want to execute inside it. Then, make the file executable and readable and you have a shell script file. A shell program is more complicated; you need to support the user features that most users would expect a shell program or shell interpreter to do. I would suggest studying the source code of a current shell program to see how to go about implementing one of your own.
No. All commands are executed in userspace. If the command is not built-in to the shell, it will look in a binary directory (/sbin, /bin, /usr/bin, or /usr/local/bin) for a program matching that name.