Sponsored Content
Top Forums Shell Programming and Scripting PS3 and SELECT, is it possible to put a line break? Post 302700075 by Don Cragun on Thursday 13th of September 2012 01:47:50 AM
Old 09-13-2012
Quote:
Originally Posted by newbie_01
Hi Don,

Thanks for your reply. I have to use your first suggestion, why didn't I think of that Smilie Reason being is that your second suggestion does not work on PDKsh and KSH88 Smilie ...I tried it out on the 3 servers that I need to run the script for and the second suggestion you mentioned only works for KSH93.

Good idea on using the return instead of exit. Just to clarify, the return will always return to the calling sub, correct?

BTW, I also just discovered that if I have more than 4 select options to choose, it wraps into the next column, is there any way to control this behavior?

Thanks again for reply.
Yes, ksh didn't add support for $'...' until ksh93.

I'm not sure what you mean by calling sub. In my example, menu_main was called from the main body of the ksh script. A return from a ksh function or dot script will return to the invoking shell script.

I'm also not sure what you mean by wraps into the next column. If you mean that adding more choices to the select makes that line in your script wider than your screen width or editing window width, you can use a
backslash newline to continue your choices onto the next line. For example:
Code:
#!/bin/ksh
menu_main1() {
        PS3="
::  Please choose a VALID option : "
        printf "\n\n"
        select choice_main in "Generic SA" "Refresh Tasks" "Others" \
                "Do Something Else" "Return"
        do
                case $choice_main in
                ( "Generic SA" )
                        echo "Generic SA"
                        clear
                        menu_db_admin;;
                ( "Refresh Tasks" )
                        echo "Refresh Tasks";;
                ( "Others" )
                        echo "Others";;
                ( "Do Something Else" )
                        echo Do Something else;;
                ( "Return" )
                        return;;
                esac
        done
}
echo about to call menu_main1
menu_main1
echo menu_main1 has returned

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Out put with select date. Help !!!

If I have a flatfile like vote.dat NAME | SEX | DATETIME | VOTE Jason|M|2005-12-10 08.01.30|Y Benson|M|2005-12-10 12.01.00|Y William|M|2005-12-10 08.01.09|Y Nick|M|2005-12-11 09.01.07|Y Pascal|M|2005-12-11 01.01.06|Y Mickey|F|2005-12-12 12.01.30|Y How can I write a korn script to have... (4 Replies)
Discussion started by: sabercats
4 Replies

2. Shell Programming and Scripting

TO break a line

hi All, Have a doubt in ksh..Am not familiar with arrays but i have tried out a script.. plzzzzz correct me with the script My i/p File is: (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host = 192.168.2.2) (Port = 1525) ) ) (CONNECT_DATA = (SID = TESTDB1) ) ) ... (7 Replies)
Discussion started by: aajan
7 Replies

3. Shell Programming and Scripting

BASH: Break line, read, break again, read again...

...when the lines use both a colon and commas to separate the parts you want read as information. The first version of this script used cut and other non-Bash-builtins, frequently, which made it nice and zippy with little more than average processor load in GNOME Terminal but, predictably, slow... (2 Replies)
Discussion started by: SilversleevesX
2 Replies

4. Shell Programming and Scripting

Remove line based on string and put new line with parameter

Hi Folks, I am new to ksh, i have informatica parameter file that i need to update everyday with shell script. i need your help updating this file with new parameters. sample data $$TABLE1_DATE=04-27-2011 $$TABLE2_DATE=04-23-2011 $$TABLE3_DATE=03-19-2011 .......Highligned... (4 Replies)
Discussion started by: victor369
4 Replies

5. Shell Programming and Scripting

Add line break for each line in a file

I cannot seem to get this to work.. I have a file which has about 100 lines, and there is no end of line (line break \n) at the end of each line, and this is causing problem when i paste them into an application. the file looks like this this is a test that is a test balblblablblhblbha... (1 Reply)
Discussion started by: fedora
1 Replies

6. Shell Programming and Scripting

sed with line break

<td> CIS </td>and I tried to sed 's/<td>\/nCIS\/n<\/td>/<td><\/td>' and sed 's/<td>\/rCIS\/r<\/td>/<td><\/td>' , but no joy. This is an html page that I need to clean. (4 Replies)
Discussion started by: dba_frog
4 Replies

7. UNIX for Dummies Questions & Answers

VI Line Break?

So I'm in a Unix class and our assignment was to go into VI and write a script to make this file tree. At the end of it, I'd like it to echo "This is the file tree you've created" then a line break, then . But I'm not sure as to who to do it. Is there a way for when I run it (./filesystem), the... (4 Replies)
Discussion started by: bbowers
4 Replies

8. Shell Programming and Scripting

PS3 select when wrong input given

Hi All I am using the below code to chose a file to view : PS3="Select file to view : " select FILE in `ls` QUIT do if ; then clear cat $FILE else break fi REPLY='' done Everything works fine as long as I am giving the correct choice . But when i give a... (4 Replies)
Discussion started by: ningy
4 Replies

9. Shell Programming and Scripting

Is is possible to pass multiple entries in PS3 select ?

PS3="Enter corresponding number and hit enter:" select DIR in `cat mylist` QUIT do if then echo "INVALID INPUT" else if ; then my commands ..... else break fi fi REPLY='' done The above will return something like below : Select from the list of... (4 Replies)
Discussion started by: ningy
4 Replies

10. Shell Programming and Scripting

How to break the line to the one above?

Hello everyone! I'm trying to make the below file1 look like file2, can anyone help? Basically I just hit backspace on every line that starts with a number. Thanks! file1: THIS#IS-IT1 4 THIS#IS-IT2 3 THIS#IS-IT3 2 THIS#IS-IT4 1 Result > file2: (4 Replies)
Discussion started by: demmel
4 Replies
DCSORT(1)					      DICOM PS3 - Make sorted list of images						 DCSORT(1)

NAME
dcsort - ACR/NEMA DICOM PS3 ... DICOM PS3 - Make sorted list of images SYNOPSIS
dcsort " inputfile1 [ inputfile2 ... ]" [ -v|verbose ] [ -vv|veryverbose ] [ -vvv|veryveryverbose ] [ -index ] [ -show ] [ -interval ] [ -tolerance mm ] [ -check ] [ -checkFoR ] [ -descending ] [ -sortby|k attributename ] DESCRIPTION
dcsort reads the named dicom input files and sorts them by the specified sort key. The sort key should be a single valued numeric attribute, with the exception of ImageOrientationPatient and ImagePositionPatient which are handled as special cases. There is no output by default unless the index or verbose options are specified. OPTIONS
The output and errors go to standard error. The basic input switches are described in dcintro(1). Options specific to this program are: -index Creates a first column of output that is the index in the sort order, starting from 0, and a second column that is the filename. -show Show the value of the sort key after the file name with the -index option -interval Show the interval between values of the sort key, or an error if not equal -tolerance mm The tolerance value in mm to use when comparing intervals between slices; defaults to +/- 0.01 mm if unspecified -check Check that all the images are from the same series. -checkFoR Check that all the images have the same Frame of Reference (UID). -descending Sort in descending, rather than the default ascending, order. -sortby|k attributename Specify attributename as the sort key. ENVIRONMENT
EXAMPLES
% dcsort -index -sortby SliceLocation ./1/[0-9]* 0 ./1/1 1 ./1/2 FILES
SEE ALSO
dcintro(1) AUTHOR
Copyright (C) 1993-2010. David A. Clunie DBA PixelMed Publishing. All rights reserved. BUGS
DICOM PS3 22 December 2006 DCSORT(1)
All times are GMT -4. The time now is 03:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy