Sponsored Content
Top Forums Shell Programming and Scripting Quick edit on accepted variable. Post 302316484 by ekb on Friday 15th of May 2009 08:39:30 AM
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
 

8 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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
tip(1)							      General Commands Manual							    tip(1)

NAME
tip - Connects to a remote system SYNOPSIS
tip [-v] [-baud_rate] system | telephone_number The tip command connects to a remote system and allows you to work on the remote system as if logged in directly. OPTIONS
Displays sets of variables (see Variables) as they are read from the file. Overrides the default baud rate, which is 1200 baud. DESCRIPTION
You must have a login account on the remote system to use the tip command. Either the system argument or the telephone_number argument is required. The system argument specifies the name of a remote system to be contacted over a direct or modem connection. The telephone_number argument specifies the number to dial over a modem connection. The actions of the tip command can be controlled using flags, escape signals, and variables. The tip command also uses the /etc/remote file to find out how to contact a remote system and discover the escape-send sequence to use when communicating with that system. When tip prompts for a response, edit the line as you type using the standard Erase and Kill keys. Entering a null line in response to a prompt or pressing the Interrupt key sequence will abort the tip dialog and return you to the remote system. The tip command uses lock files in the /var/spool/locks directory to lock devices against multiple access. You can use the tip command to transfer files to and from the remote system. Several variables work together to control file transfers. File transfers normally use tandem mode to control the flow of data. If the remote system does not support tandem mode, set the echocheck variable to on to cause tip to synchronize with the remote system after transmitting each character. When transferring files with the ~> and ~< commands, use the eofread and eofwrite variables to specify the end of a file when writing, and recognize the end of a file when reading. If the verbose variable is set to on, the tip command: Writes a running count of the number of lines transferred during a file transfer. Writes messages indicating its actions as it dials a telephone number. You can use scripting to record the conversations you have with the tip command. Use the script variable to start scripting. Variables The tip command uses variables that control its operation. These variables can be numeric, string, character, or Boolean values. Some of these variables can be changed by any user who can run the tip command. However, the following variables can be changed only by a user with superuser authority: baudrate, dialtimeout, host, phones, and remote. Variables can be initialized at run time in the $HOME/.tiprc file. Additionally, you can display and set the variables while already run- ning the tip command by using the ~s command. Certain common variables have abbreviations. Following are the common variables, their types and abbreviations, and their default values. (Boolean; abbreviated be) Discards unprint- able characters when a session is being scripted. Does not discard characters specified with the exceptions variable. The default is on. (Numeric; abbreviated ba) Specifies the baud rate of the connection. The baudrate setting can only be changed by someone with superuser authority. (Numeric; abbreviated dial) Specifies the time (in seconds) that tip waits for a connection when dialing a telephone number. The default is 60 seconds. The dialtimeout setting can only be changed by someone with superuser authority. (Boolean; abbreviated ec) Instructs tip to syn- chronize with the remote host during a file transfer by awaiting the echo of the last character transmitted before transmitting the next character. The default is off. (String; abbreviated eofr) Specifies the set of characters that signifies an end-of-transmis- sion during a remote to local (~< or ~t) file transfer. (String; abbreviated eofw) Specifies the string that is sent to indicate end-of-transmission during a local to remote (~> or ~p) file transfer command. (String; no abbreviation) Specifies the string that indicates the end of a line. tip recognizes escape signals only when they follow an end-of-line string. (Character; abbreviated es) Specifies the command prefix character for escape signals. The default value is ~ (tilde). (Strings; abbreviated ex) Specifies the set of characters that are not discarded, even when the beautify switch is set on. The string f is the default. (Char- acter; abbreviated fo) Specifies the character that is used to force literal data transmissions during binary transfers. The char- acter ^P is the default. Literal data transmissions are off until the user types the character specified by the force variable. (Numeric; abbreviated fr) Specifies the number of bytes to buffer between file system writes when receiving files from the remote system. (String; abbreviated ho) Specifies the name of the remote system to which you are connected. The host setting can only be changed by someone with superuser authority. (Character; abbreviated pr) Specifies the character that indicates the end of the line on the remote host. This character is used to synchronize during data transfers. The tip command counts lines transferred during a file transfer, based on the number of times it receives the prompt character. The character is the default. (Boolean; abbreviated ra) When on, instructs the tip command to convert all lowercase letters to uppercase before transmitting them to the remote system. The default is off. (Character; abbreviated rc) Specifies a character that is used to tog- gle uppercase conversion. The default value is ^A. (String; abbreviated rec) Specifies the name of the file in which the tip com- mand records the session script. The default is the tip.record file, which is placed in the user's current directory on the local system. (Boolean; abbreviated sc) When on, tip records everything transmitted by the remote machine in a file on the local system. The filename is specified by the record variable. If the beautify switch is on, only printable ASCII characters (those between 040 and 0177) will be recorded in the script file. The exceptions variable specifies unprintable characters that will be recorded even if the beautify switch is on. The default setting for the script switch is off. (Boolean; abbreviated tab) Expands tab characters to eight spaces during file transfers. The default is off. (Boolean; abbreviated verb) When on, tip prints messages while dialing, shows the current number of lines transferred during a file transfer, and displays other status information about the connection. The default is on. (String; no abbreviation) Specifies the type of shell to use for the ~! command. The default value is /bin/sh, or is taken from the environment. (String; no abbreviation) Specifies the home directory to use for the ~c command. The default value is taken from the environment. Subcommands You can use escape signals to instruct tip to terminate, log off from the remote system, and transfer files. Using the escape character as the first character of the line indicates an escape signal. The default escape character is a ~ (tilde). The character can be changed using the escape variable. All other typed characters are transmitted directly to the remote system. The tip command recognizes the fol- lowing escape signals: Terminates the connection and exits. You can still be logged in on the remote system; if so, you can issue another tip command to reconnect to that system. Depending on the interconnection hardware, it may be necessary to use ~^D to terminate the conver- sation, even if the normal logout sequence was used. Same as ~^D: terminates the connection and exits. You can still be logged in on the remote system; if so, you can issue another tip command to reconnect to that system. Depending on the interconnection hardware, it may be necessary to use ~. to terminate the conversation, even if the normal logout sequence was used. Changes to the directory specified by the directory variable. If you do not include the directory variable, tip changes to your home directory. Escapes to a shell on the local system. When you exit from the shell, you return to the tip command. Copies file from the local system to the remote system. The tip com- mand prompts you for the name of the local file. Before executing this command, you should start a command on the remote system to capture the incoming file as it is sent. Otherwise, the file contents are treated as stdin to the shell running on the remote system. Using the cat > destfile command is recommended where supported. The output EOF string sent after the file is transferred (defined by oe in /etc/remote and typically ^D for UNIX systems) should terminate the command on the remote system that is capturing the file. Copies file from the remote system to the local system. The tip command prompts you for the command to be executed on the remote system to list the file to be copied, for example, cat srcfile. The copy of the file completes when the local system reads an EOFREAD character from the remote system. The local system defines the EOFREAD character(s) expected from the remote system by the ie entry in /etc/remote. (For UNIX systems, this is usually #, %, or $, the most common prompts for the different shells.) The EOFREAD character should be sent to the local system after the command to list the remote file completes. The remote system's prompt character is suggested for the EOFREAD char- acter. Sends the from file to a remote host that must support the cat command. The put command causes the remote system to run the com- mand string cat > to, while tip sends it the from file. If to is not specified, the cat command uses the name of the from file. This com- mand is a special case of the ~> command. Transfers the from file from a remote system that must support the cat command. As in the put command, the to file defaults to the from filename if it is not specified. The remote host executes the command string cat from;echo ^A to send the file to tip. This command is a special case of the ~< command. Pipes the output of a remote command to a local process. The com- mand string sent to the local system is processed by the shell. Pipes the output from a local process to the remote system. The command string sent to the remote system is processed by the shell. Sends a BREAK signal to the remote system. Sets or queries the tip command variables. To display all variables readable by the user, specify all as an argument to the ~s command. You can also request the display of a specific variable by attaching a ? (question mark) to the variable name. For example, enter the command ~s eol? to display the current end-of-line string. Variables can be numeric, string, character, or Boolean values. To set a non-Boolean variable, enter the variable name or abbrevia- tion followed by = (equal sign) and the value. For example, enter either ~s host=zeus or ~s ho=zeus to change the hostname to zeus. In the file, enter host=zeus or ho=zeus. To change the value of a Boolean variable, enter the variable name or abbreviation as an argument to the ~s command, or on a line of the file. To reset the variable to its default value, enter an ! (exclamation point) in front of the name. For example, enter ~s !echocheck to reset the echocheck variable to its default value while running the tip command. You can use a single ~s command to set and query multiple variables. The set string must not contain any spaces. Stops tip. The ~^Z command is only available with job control. Stops the local portion of tip. The remote portion, which displays the output from the remote system, continues to run. The ~^Y command is only available with job control. Displays a list of the escape signals. RESTRICTIONS
The user-id (uid) of the owner of the file must be the same as the real uid of the tip process. If this is not true, an error message is output and the file is not read. EXAMPLES
To specify a baud rate when making a direct connection, enter: tip -300 hera This instructs tip to use a baud rate of 300 when contacting remote system hera. To connect to a remote system using a modem, enter: tip 9,343-2132 This connects the remote system that is reached by the telephone number 343-2132, after dialing a 9, to reach an outside line. To connect directly to a remote system and display the variables, enter: tip -v hera The -v option causes tip to display the values of the variables as it reads them from the $HOME/.tiprc file. If the file contains the following settings: sc be rec=/u/jimk/callout The output from the -v option is as follows: set script set beautify set record=/u/jimk/callout FILES
Contains automatic call unit descriptions. Contains lock files that prevent multiple uses of devices and multiple calls to systems. Con- tains global system descriptions. Contains global telephone phone number database. Contains private system descriptions. Contains pri- vate telephone numbers. Defines initial settings for the tip command. Contains the tip command scripts (default filename). By default, stored in the current directory. You can change the filename and directory using the record variable. SEE ALSO
Commands: cu(1), uucp(1) Functions: connect(2) Files: acucap(4), phones(4), remote(4) tip(1)
All times are GMT -4. The time now is 09:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy