Saturday, February 9, 2013

LS command - File & Directory listing

ls [opt]
       -a     list hidden files
       -d     list the name of the current directory
       -F     show directories with a trailing '/'
                 executable files with a trailing '*'
       -l     long listing giving details about files and directories
       -R     list all subdirectories encountered
       -t     sort by time modified instead of name

Examples:

Display one file per line

$ ls -1
bin
etc
home
lib 


Shell Types

  • The Bourne (or standard) shell, the most compact shell but also the simplest.
  • The Korn shell, a superset of the Bourne shell that lets you edit the command line.
  • The C shell, which uses C syntax and has many conveniences.

Most systems have more than one shell,

The /etc/passwd file determines which shell takes
If the program Your shell will be the:

shell name is: 
/bin/sh Bourne shell
/bin/rsh Restricted Bourne shell
/bin/jsh Bourne shell, including job control
/bin/ksh Korn shell
/bin/rksh Restricted Korn shell
/bin/csh C shell

change from the Bourne shell to the C shell, type:     $ exec csh

What is Shell Script ? Why want to create Shell Script?

  • A shell script is a text file with Unix commands in it.
  • Shell scripts usually begin with a #! and a shell name (complete path-name of shell).
  • Path-name of shell be found using the which command.
  • The shell name is the shell that will execute this script.
  • If no shell is specified in the script file, the default is chosen to be the currently executing shell.

 E.g:
#!/bin/bash
 echo “Hello World”;
 exit 0;

Here
       #!/bin/bash    -  shell name , the program will execute this environment 


Why want to write shell script?

To avoid repetition:

  • If you do a sequence of steps with standard Unix commands over and over, why not do it all with just one command?
  • Or in other words, store all these commands in a file and execute them one by one.

EBS Order Holds details and release responsibility

  SELECT ooh.order_number,                  ooh.ordered_date,                 ooh.flow_status_code,                 ooh.credit_card_approval...