Quick edit on accepted variable.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Quick edit on accepted variable.
# 1  
Old 05-15-2009
Lightbulb Quick edit on accepted variable.

I am new newbie to unix.

I am taking user input using ksh script.

The valid value user can enter is

a) Numeric 1 to 500
b) character e, r
c) e1 to e100

I figured out how to deal with a) and b) but want to separate characters when user enter e1 to e100

I want to store e in variable and numeric part followed by e in other variable.

Any quick tip to separate will work.

Do we have "cut" till end of command ?

Thanks.Smilie
# 2  
Old 05-15-2009
as u know first character is e , u can store it directly

Code:
 
 value=`echo "$var_apped" |sed 's/e//'`
 
 cha=e

Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh script trying to pass a variable to edit a file

I'm trying to create a ksh script that will ask the user for the port number. $PORT1 is the variable I want to use that will contain whatever numbers the user inputs. The script would edit ports.txt file, search and delete "./serv 110.1.0.1.$PORT1 200;=3" . So if the user types 50243 then the... (5 Replies)
Discussion started by: seekryts15
5 Replies

2. Shell Programming and Scripting

Quick question on expanding variable

s=`awk '{ print $0}' /Applications/Relink.app/z_cloudline.txt` sed -n '"$s"' /var/mobile/Library/iFile/Bookmarks.plist > /var/mobile/originalip.txt What is the problem with that code ? With variable it only outputs: sed: -e expression #1, char 1: unknown command: `"' If I use the... (3 Replies)
Discussion started by: pasc
3 Replies

3. Shell Programming and Scripting

Edit variable in a file

Hello, I have a script which reads variable values from /system/pt.conf I sourced it already. But the probelm is I don't know how to edit only the value from the variable "res" in the conf file. pt.conf: res=1280x720 log=1 And I want to edit the value "1280x720" from "res". I was... (5 Replies)
Discussion started by: FD1999
5 Replies

4. Shell Programming and Scripting

How to edit specific variable in file?

HI guys i have a question. Question 1: how do i modify a particular string? e.g echo "Please enter Book Title: " read a echo "Please enter Author: " read b if ] then echo " Record found!" which will then pop out a menu with the follow output 1. Update Name 2.... (1 Reply)
Discussion started by: ichar
1 Replies

5. Shell Programming and Scripting

In bash, read to a variable with a default value to edit

My script needs to read a variable from the user. But before the user types the input, I want to give a default value so the user can edit the default value for input. How can I implement it? My script is something like: #!/bin/sh read -p 'Port number: ' -e port_number echo "Port... (7 Replies)
Discussion started by: pankai
7 Replies

6. Solaris

Password accepted but kicked out

The Sun Solaris x86 system seemed to accept my username and password when I do SSH, but then the login prompt went away or hang. What happened? (8 Replies)
Discussion started by: conandor
8 Replies

7. Post Here to Contact Site Administrators and Moderators

Solution accepted

Is there any status like open/close or solution is accepted by the owner? This can make a lot of difference as we need not look for questions that have already been answered.(saves time). (1 Reply)
Discussion started by: sudhamacs
1 Replies

8. Shell Programming and Scripting

Quick Variable Question

Hi, this is probably very easy but, how do I define a variable for more than one line. For example: var1='more than one line' when I call it, I want it to be exactly like this, don't want all the words on the same line. (10 Replies)
Discussion started by: starks
10 Replies
Login or Register to Ask a Question