Solved

Case exe.

Posted on 2002-07-26
6
201 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
modThree challenge 4 90
post4 challenge 28 100
abstract class with all non abstract mentods 6 76
MaxSpan challenge 9 96
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 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