Solved

Case exe.

Posted on 2002-07-26
6
200 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now