?
Solved

Case exe.

Posted on 2002-07-26
6
Medium Priority
?
207 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
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 
LVL 51

Expert Comment

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

Accepted Solution

by:
jools earned 90 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

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. …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

801 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