TCSH scripting and make file

 

  • TCSH scripting:

We write our tcsh commands in gvim file.

The first line of the file should be the shell interpreter so that the shell understands on which shell it has to execute.

#! / path of the shell installed/

Eg: #! /bin/tcsh

#!  -> it is known as shell interpreter.

To execute the file in shell we need to first give the execute permission to the file.

To execute we need to use : shell name /path of the gvim file/

Eg : tcsh ./command.tcsh

If we want some particular commands to not be executed use: so all the commands within if and endif will not be executed.

If 0 then

....

Endif

If we want to execute only few commands and not other commands write “exit” after the commands that are to be executed so that all the commands below exit will not be executed.

Loops: 

  1. Foreach: 

Foreach variable ($variable)

...

End


  1. While:

Initialization

While(condition)

Increment

End

Conditional statements: 

  1. If(condition) then

....

endif

  1. If(condition) then

...

Else

...

endif

  1. If(condition) then

....

Elseif(condition) then

...

Else

...

Endif

  1. Switch(strng)

Case pattern1:

Breaksw

Case pattern2:

Breaksw

Default:

Breaksw

Endsw


Command line arguments:

$0: file name or command name

$1,$2... : 1st argument,2nd argument...

$argv[1],$argv[2]...: 1st argument,2nd argument...

$#argv: number of arguments passed while executing.

$* : Special parameter takes entire list as one argument.

$? : Exit status





File operators:

-d: directory

-f : file

-x: executable

-w: writable

-r: readable




  • Make file:

It is used to compile different types of files all together.

The file has to be saved with name “makefile” in a “make” directory.

To execute a makefile :

./makefile

We need to use target and source in the makefile to get access to the file execution.

The makefile has to be given with execution permission.






Comments

Popular posts from this blog

PERL scripting

SHORT CHANNEL DEVICE

Introduction to CMOS inverter