Gang's Tech Stuff

Posts Tagged ‘shell script

Converting lowercase to uppercase in Shell scripts

Posted by: Gangadhar on: March 26, 2009

Have you ever wondered why there is no toUpper() kind of function in shell script? Well, i think the reason is typeset command. What does it do exactly? A lot: * Set a parameter as an integer by using -i option so as to fasten the arithmetic operations on that variable. * Convert to lower [...]

expect in Shell scripts

Posted by: Gangadhar on: December 17, 2008

We can use expect to automate the interactive scripts which may expect some inputs from the user. Search in the net for more info. Following code snippet can give you can idea how an expect script may look like. The “cmdFile” may contain some commands to achieve some functionality like changing the current directory and [...]

Debug mode in SHELL scripts

Posted by: Gangadhar on: December 17, 2008

To run a shell script in DEBUG mode, put “-x” option at the end of the interpreter in the first line. #!/usr/local/bin/sh –x This is going to print the steps the compiler goes through.


Follow

Get every new post delivered to your Inbox.