Solved

Case exe.

Posted on 2002-07-26
6
204 Views
Last Modified: 2013-12-26
#!/bin/ksh
temp_editfile=.
CWD=1
case $temp_editfile in
        /*)
                 editfile=temp_editfile
                 echo "this is slash with something else"
                 ;;
        ~*)
                 editfile=temp_editfile
                  echo "this is tilda with something else"
                 ;;
         *)      editfile=$CWD cat temp_editfile
                  echo "this will do concatetion"
                ;;
esac
echo $editfile



Is there any errors in the files? I can't execute it. thanks

the file name is justforfun. the output:
*******************************
/home/karen $ justforfun /ksh

/home/karen $
********************************

1. is this the correct way to pass in the argument?
2. why didn't the (/ksh) enters the case function?

3. how can i compare a variable and an exclamation mark?
   eg. if [ "$variable" == "!" ]


0
Comment
Question by:karencck
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 19

Expert Comment

by:jools
ID: 7180647
what happens when you try to execute it?

do
 
ksh -x scriptname

and post the output here.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7181189
~*  will not work in case as (you might) expected.
The shell expands the tilde to the directory name when you use it in your assignment.

Please tell us what in particular is not working.
0
 

Author Comment

by:karencck
ID: 7181701
/home/karen $ justforfun \ksh

/home/karen $

it seems like there are no ouptut. it didn't enter the case function
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 51

Expert Comment

by:ahoffmann
ID: 7181752
please post results of jool's suggestion
0
 
LVL 19

Accepted Solution

by:
jools earned 30 total points
ID: 7181900
ksh -x would show us exactly what the script was doing, looking at your script example, do you need to use;

    temp_editfile=$1

We will be able to assist easier if ksh -x output is posted.

0
 

Author Comment

by:karencck
ID: 7193017
sorry for the late reply. thanks jools
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB.NET how to use the Vertical ScrollBar 5 119
Turn a spreadsheet into a vba executable. 2 98
sum28 challenge 31 117
sumHeights  challenge 17 79
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question