![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Passing global variable to a function which is called by another function | sars | Shell Programming and Scripting | 4 | 06-30-2008 08:39 AM |
| Log function | Ernst | Shell Programming and Scripting | 17 | 03-19-2007 08:31 AM |
| Function within function (Recurance) | chassis | UNIX for Dummies Questions & Answers | 2 | 09-19-2006 06:32 AM |
| awk with function ?? please, help :( | sabercats | Shell Programming and Scripting | 0 | 03-13-2006 03:52 PM |
| How to convert the "select" function into a "poll" function | rbolante | High Level Programming | 1 | 07-10-2001 07:49 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
function help
Hey guys
Iam a newbie.Previously u guyz helped me.Thanks alot.Iam writing a small and easy script to call a function.but it is showing me error. Here is the example iam writing demo() { echo -n "hello this is a demo" } echo -n " do u want to see a demo or not (y/n):" read ans if [["$ans" = "$y"]] demo fi if [["$ans" = "$n"]] exit fi For this script iam getting error.And also if i want to run it for ksh.Is it going to same or the script gonna change.Please help me guyz. Thanks CoolKid |
| Forum Sponsor | ||
|
|
|
|||
|
use code tags next time.
Code:
demo()
{
echo "hello this is a demo"
}
echo " do u want to see a demo or not (y/n):\c"
read ans
if [[ "$ans" = "y" ]]; then
demo
fi
if [[ "$ans" = "n" ]] ; then
exit
fi
Try to read and see the differences. |