Sponsored Content
Top Forums Shell Programming and Scripting Pass values to case statement in a function korn shell Post 302778881 by squrcles on Monday 11th of March 2013 05:08:07 PM
Old 03-11-2013
Pass values to case statement in a function korn shell

I'm in the process of writng a function that consists of a case statement is there a way of calling the function and passing a value to it?

ie

function1 () {
case
opt1 do .....
opt2 do.....
esac
}

function opt1

I'm aware the syntax is not correct, but you get the general idea.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

korn shell to bash - statement not working

Everything else seems to be working, but this isn't. Is it the "cat..." that is wrong of the condition? Thanks. cat tc_result.txt | while read LINE do if then let "files_run += 1"; echo "inside the if loop" # save current filetype case $LINE... (5 Replies)
Discussion started by: brdholman
5 Replies

2. UNIX for Dummies Questions & Answers

if test case in korn shell

hi, I am new to this forum and this is my first post. I am not too familiar with scripting so I will be spending a lot of time here. I am trying to understand a ksh script. NSCA=/bin/send_nsca if ] What does the -e check for? (3 Replies)
Discussion started by: fluke_perf
3 Replies

3. Shell Programming and Scripting

shell script case statement

In a case statement like below : case $rental in "car") echo "For $rental Rs.20 per k/m";; "van") echo "For $rental Rs.10 per k/m";; "jeep") echo "For $rental Rs.5 per k/m";; "bicycle") echo "For $rental 20 paisa per k/m";; *) echo "Sorry, I can not gat a $rental for you";;... (4 Replies)
Discussion started by: sriram003
4 Replies

4. Shell Programming and Scripting

Using Subroutine / Function in case statement

I have issue running functions under case statement #!/bin/bash single() { Commands } multiple() { Commands } until ; do echo -e " \t \t M A I N - M E N U Perforce delete script \n" (1 Reply)
Discussion started by: sriram003
1 Replies

5. Shell Programming and Scripting

Shell case statement

echo -e "Select: \c" read IN pattern="1-20" case $IN in ) echo "Selected: $IN" ;; *) echo "Invalid selection: $IN" ;; esac # sh test Select: 10 Invalid selection: 10 # sh test Select: 2 (6 Replies)
Discussion started by: Ikon
6 Replies

6. Shell Programming and Scripting

Running a function from a case statement

Hi, I have the below script that should take the command line option and run the desired script on another server. Only it doesn't seem to run the function, infact it just returns back to the command line. case $1 in 1) msgbacklog() ;; 2) jobstatus() ;; ... (10 Replies)
Discussion started by: chris01010
10 Replies

7. Programming

pass value from Oracle sql to Korn shell

Hi All , I am trying to pass a value from sqlplus to korn shell . There is a table tab1 in Oracle that has a column userdate. I need to pass the userdate to the korn shell . This is what I am doing . VALUE=`sqlplus -silent username/password << END set pagesize 0 feedback off verify off... (14 Replies)
Discussion started by: megha2525
14 Replies

8. Shell Programming and Scripting

Korn shell script - SQL statement challenges

Hi scripting experts. I have some coding challenges that I'm hoping you can help me out. I have one file#1 that contains the following sql statement that spans over multiple lines: sql Select /*+ use_has(a,b) */ * from customer a, customer_address b where a.id = b.id... (1 Reply)
Discussion started by: pchang
1 Replies

9. Shell Programming and Scripting

Using shell to generate case statement

Hi Gurus, I have a very weird requirement and have no clue to resolve the issue. please help me get out this difficulty below two tables, table1 contains the column name. D means this column used for the rule. for example: rule 0 is all columns have value, rule1 is col3 and col7 have no value.... (2 Replies)
Discussion started by: Torhong
2 Replies

10. Shell Programming and Scripting

Shell scripting with case statement

Foe example we have three environments int,qa and prod.Each environment has some number of servers. int=Server1,Server2,Server3 qa=Server4,Server5,Server6 prod=Server7,Server8,Server9 echo "Enter the Environment i.e int,qa,prod" read env case $env in int) ## Need command where all the... (9 Replies)
Discussion started by: nareshreddy443
9 Replies
BOOTCDWRITE.CONF(5)						   bootcd utils 					       BOOTCDWRITE.CONF(5)

NAME
bootcdwrite.conf - configuration file for bootcdwrite DESCRIPTION
The file bootcdwrite.conf contains configuration option for the bootcdwrite(1) program of the same named package. The file must be located in the configuration directory which is usually /etc/bootcd. Blank lines are ignored and lines with leading # are comments. Values have to be set with name=value FORMAT
SRCDISK="<path>" Define the filesystems root directory from which to build an image. If you want to build bootcd from a remote system, export root- directory with nfs, mount it locally and add SRCDISK=<mountpoint>. Default is "/" KERNEL="<path>" Define the path to the kernel which should be used. (SRCDISK will be automatically added to path if path does not start with "/" !) Default is "vmlinuz" KERNEL<number>="<path>" You can define multiple additional kernels with <number>. The numbers have to start with 1 and can continue with 2, 3, 4 .... The syntax is as defined in KERNEL A label for KERNEL<number> can e defined with KLABEL<number> the default is KLABEL<number>=linux<num- ber> INITRD="<path>" Recent official debian kernel images (2.4.x) have started installing initrd images. If you want to use such a kernel to build a bootcd without recompiling the kernel you have to use an initrd image and add it here. (SRCDISK will be automatically added to path of INITRD if it does not start with "/" !) The installed initrd image used to boot from hard disk does not always work from cdrom and miss some drivers and features you need for bootcd. If CDDEV="auto" should be used, you have to build a new initrd. Install bootcd-mkinitramfs to do so. Default is "initrd.img" INITRD<number>="<path>" If KERNEL<number> is defined an initrd for this kernel can be defined here. RAMDISK_SIZE=<number in kByte> Two Ramdisks ram1 and ram2 will be created, with the following directories: ram1: /dev /etc /home /root /tmp ram2: /var Both Ramdisks have the same size which is defined by RAMDISK_SIZE. Default is 16384 TYP="<CD|DVD>" Define TYP=CD or TYP=DVD if you want to get a warning if the size of the image will be larger as a CD or DVD. The CD or DVD itself will no longer be automatically burned by bootcdwrite. Only the iso image will be created. Default is "CD" CDDEV="<auto|device> [...]"> You can specify one or more CD devices to boot from and/or auto. The first entry is the default, the others will be given as boot options to the user. See DISPLAY. Devices are separated by spaces. If you use INITRD and you have installed installed bootcd- mkinitramfs you can use "auto" to try to find the bootcd on all SCSI and IDE CDROMS automatically. Default is "auto /dev/hda /dev/hdb /dev/hdc /dev/hdd /dev/r0 /dev/sr1" DISPLAY[<number>]="<file>" Define the text to display at boot time (see syslinux doku), this option is not supported for hppa. At boot time you can press Function Keys to see the text files. (F1 = DISPLAY, F2 = DISPLAY2, F3 = DISPLAY3 ...) Default for DISPLAY is "/usr/share/bootcd/default.txt" The word kernelinfo will be replaced with a file which includes some kernelinfo. F10 lists all people mentioned in changelog.gz. DO_CHECK="<yes|no>" To check for possible problems can take a long time, but it is recommended to do the checks. Default="yes" APPEND="<kernel parameter>" If you need kernel options other than "root=..." see append in lilo.conf(5). Default is "" APPEND<number>="<kernel parameter>" If KERNEL<number> is defined kernel parameters for this kernel can be defined here. NOT_TO_CD="" Add directories which should be excluded from bootcd. Directories are separated by spaces. (SRCDISK will be automatically added to each path that does not start with "/" !). Default is "" NOT_TO_RAM="" When you boot from CD parts of the CD will be copied to ram. Here you can decide, what should not go to ram. The directories /etc /var /dev /tmp /home and /root will be in RAM because they have to be writable. Directories are separated by spaces. On CD this dirs will get different names (/etc.ro, /var.ro, ...) but you do not have to use those different names in NOT_TO_RAM any more !!! If you exclude files in NOT_TO_RAM, they will be copied to CD and you will find a symbolic link instead of the file in RAM point- ing to the file on CD. (SRCDISK will be automatically added to each path that does not start with "/" !). Because most people's home and root directories are to large to include in RAM, subdirectories can be excluded with the default setting. Default is "$(find $SRCDISK/home $SRCDISK/root -maxdepth 1 -mindepth 1 -type d)" SSHOSTKEY="<yes|no>" If you are using ssh it is helpful to have a unique ssh hostkey for each CD. This will be generated at burntime with SSH- HOSTKEY="<yes>". Default is "no" UDEV_FIXNET=<yes|no> If you are using the udev filesystem and want to install the image on other machines, you need to set this to "yes" because the net- work interfaces are hardwired in /etc/udev/rules.d/z25_persistent-net.rules (etch) or in /etc/udev/rules.d/70-persistent-net.rules (lenny) and we must remove them. Default is "no" ERRORLOG="<file>" All errors would be logged to this location. Default is "/var/log/bootcdwrite.log" VAR="<path>" The ISO-image is written to this directory. Default is "/var/spool/bootcd" FLOPPY_RUNTIME_DEV="<floppy device>" When you boot from cd bootcd can read changes from this device, e.g. /dev/fd0. Default is "" BOOTFLOPPY="<yes|no>" If you want to boot from FLOPPY specify BOOTFLOPPY=yes. This reduces space on floppy used by bootcdflopcp. For this to work FLOPPY_CREATE_DEV has to be specified. For hppa this option is not supported and must be set to no! Default is also "no" BOOT_ONLY_WITH_FLOPPY="<yes|no>" If you want to boot several machines from the same cdrom, you must have the individual configuration (exp: /etc/network/interfaces) on floppy. If one can not be mounted it is a good idea to stop booting and to wait for manual interaction instead of coming up with a wrong configuration. Default is "no" CLEAN_VAR="<yes|no>" Cached files in /var will be deleted, before /var will be copied to bootcd, if this parameter is set. This will minimize needed space on CD. At this time only the following command will be executed: apt-get clean. Default is "yes" FASTBOOT="<yes|no>" If is set additional images for the ramdisk will be created by bootcdwrite and copied to CD. This allows faster booting, but needs extra space on CD. Default is "yes" ISOLINUX="<auto|yes|no>" If syslinux is recent enough then isolinux can be used instead of syslinux and ISOLINUX=auto will be treated as ISOLINUX=yes. If you want to use syslinux instead you have to use ISOLINUX=no. (See also /usr/share/doc/syslinux/isolinux.doc.gz.) Default is "auto" SYSLINUX_SAVE="<yes|no>" This option for ISOLINUX. If SYSLINUX_SAVE=yes then syslinux is called with -s option. The manpage of syslinux says: this installs a "save, slow and stupid" version of syslinux. In earlier version the -s option was always used. Now you can change it. Default is "yes" ARCH="<auto|hppa|i386|ia64>" You can create bootcd for HP PA-RISC too. It is possible to let bootcdwrite detect your architecture with ARCH=auto. To use ARCH=hppa the debian package bootcd-hppa must be installed. Default is "auto" DEVFS="<yes|no>" With devfs you do not need device files and inodes in /dev/*. If running diskless this will save some ram (See /usr/src/linux/Docu- mentation/filesystems/devfs/README for more infos). It is probably better not to use this feature in future, because it will be obsolete in newer kernels. Default is "no" TO_FSTAB="<fstab entry>" Add additional mount point entries to the cdrom's /etc/fstab. If you don't want additional mount points, leave it as "". e.g.: TO_FSTAB="/dev/hdc1 /home ext3 defaults 1 1" Default is "" COMPRESS="<auto|yes|no>" If you want to have a transparent-compression ISO 9660/Rock Ridge filesystem define "yes". Use "auto" if you want compression and bootcdwrite should check the needed disk space and check for the necessary software is installed. Therefore you have to define DO_CHECK=yes if you define COMPRESS=auto. Default is "auto" NOTCOMPRESSED="<list of files and directories>" Files or Directory-Trees that should never be compressed on CD can be listed here. This is useful for documentation which should be visible without installing the bootcd-image. Define the path as it is on the CD, (with /var.ro instead of /var) and separate files and directories with spaces. Default is "" DISABLE_CRON="<list of files>" Files listed will be on the cdrom with a .no_run_on_bootcd suffix so run-parts won't execute them. The original file will be a link to /bin/true. This is meant for cron maintenance scripts which are useless on a static cdrom. The default is to disable the daily find, standard and security scripts. With bootcd2disk this files will be reactivated again. (SRCDISK will be automatically added to path if path does not start with "/" !) Default is "etc/cron.daily/find etc/cron.daily/standard etc/cron.daily/security" BOOTCDMODPROBE="<standard|bootcd|auto>" This option is only relevant, if bootcd-mkinitramfs is installed. If booted from initrd, bootcd has to load the necessary modules. If only modules provided by initramfs-tools are needed you can specify "standard" here. If bootcd should try extra hard to load necessary modules you can specify "bootcd" here. Bootcd will use discover for this purpose. So discover has to be installed. If you specify "auto", bootcd will check if discover is installed. If it is installed "BOOTCDMODPROBE=bootcd" will be set, if not "BOOTCDMODPROBE=standard" will be set. Be aware that people have reported, that sometimes BOOTCDMODPROBE=bootcd may not work but sometimes it is needed. Default is "standard" MKISOFS_CHNG="<option>" Add some additional options to mkisofs on creating cdimage. Possible syntax is MKISOFS_CHNG="[[!]<option>...]". Most people will probably define "", but it was reported that you may need the following option with newer hardware "-boot-load- size 20". Please create debian-bugreports if you have to use special options, not mentioned here. Then I can list this options here! Example: MKISOFS_CHNG="-opt1 -opt2 <value> !-opt3" means: use "-opt1" and "-opt2 <value>", don't use any previous "-opt1 [<value>...]", "-opt2 [<value>...]" and "-opt3 [<value>...]". Leave any other options as defined. function extra_changes() { return } It is possible to define a function called extra_changes to have some files modified on the ISO image. Example: function extra_changes() { echo "noname" >$VAR/changes/etc.ro/hostname } Optional FILES
/etc/bootcd/bootcdwrite.conf Configuration for bootcdwrite. SEE ALSO
bootcdwrite(1), bootcd2disk(1), bootcd(1), bootcdflopcp(1) AUTHOR
This manual page was written by Carsten Dinkelmann <Carsten.Dinkelmann@foobar-cpa.de>, for the Debian GNU/Linux system (but may be used by others). Wed Mai 15 12:15:00 MET 2005 BOOTCDWRITE.CONF(5)
All times are GMT -4. The time now is 10:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy