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
Solved

Case exe.

Posted on 2002-07-26
6
203 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
  • 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
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.

 
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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
Strange date stored 22 153
substring method in java 1 129
post4 challenge 28 104
child constructor and parent constructor, overriding and overloading 6 88
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

861 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