Sponsored Content
Top Forums Shell Programming and Scripting How can expect match the pattern "$", instead of take it as a wild card Post 302369527 by sleepy_11 on Monday 9th of November 2009 12:46:19 AM
Old 11-09-2009
Not quite get your point.

I enabled the exp_internal and updated the line with:

expect -re "#|'$'"

The output is:
Last login: Mon Nov 9 13:21:06 from host1
Sun Microsystems Inc. SunOS 5.10 Generic January 2005

expect: does " \r\nLast login: Mon Nov 9 13:21:06 from host1\r\nSun Microsystems Inc. SunOS 5.10 Generic January 2005\r\n" (spawn_id exp7) match regular expression "#|'$'"? no
$
expect: does " \r\nLast login: Mon Nov 9 13:21:06 from zcyds232.asiapa\r\nSun Microsystems Inc. SunOS 5.10 Generic January 2005\r\n$ " (spawn_id exp7) match regular expression "#|'$'"? no
expect: timed out
faxstat: Timed out after 5 seconds.

Although the "$" is shown in the telnet output....but the script doesn't match it...

also tried:

expect -re '$'

doesn't work either
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Shell Programming and Scripting

BASH find filenames in list that match certain "pattern."

I guess by "pattern," I mean something different from how that word is defined in the Linux world. If you take $ to mean a letter (a-z) and # to mean a number (0-9), then the pattern I'm trying to match is as follows: $$$##-####-###-###.jpg I'd like to write a script that reads in a list of files... (4 Replies)
Discussion started by: SilversleevesX
4 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. Shell Programming and Scripting

Expect scripting - How to match a double quotes " "

I am trying to match a text which contains the " ", from the log file. But it doesn't match. I understand that " " has got a special meaning to TCL/Expect. hence I tried the following, but no luck. expect -ex { "lp -c -demail -ot\\\"firstname_surname@gmail.com\\\"... (3 Replies)
Discussion started by: prakasuj
3 Replies

5. UNIX for Dummies Questions & Answers

Egrep confusion with "I" and "-I" pattern

I am executing following command egrep -w I filename.txt the filename.txt has following data .... -I 07-18 08:31:19.924 9880 6 SessionManager ConnectConfig: ConfigurationWebService LoginResults=SuccessfulLogin I am so hungry that I need to eat I expect egrep to print only the second... (1 Reply)
Discussion started by: VBG
1 Replies

6. UNIX for Advanced & Expert Users

AIX - io info get from "libperfstat" not match "iostat"

Hi, everyone. I need to write a program to get io info based on libperfstat. But the "write time" of a disk is just half of the value get from iostat. I'm confused and can't explain. Help please. How I calculate "write service time per sec": In iostat: write service... (0 Replies)
Discussion started by: jackliang
0 Replies

7. Shell Programming and Scripting

Expect: spawn id exp5 not open while executing "expect "$" { send "sudo su -\r" }"

Hi All, i am trying to ssh to a remote machine and execute certain command to remote machine through script. i am able to ssh but after its getting hung at the promt and after pressing ctrl +d i am gettin the out put as expect: spawn id exp5 not open while executing "expect "$" {... (3 Replies)
Discussion started by: Siddharth shivh
3 Replies

8. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

9. Shell Programming and Scripting

Search file containing ps results for a match "my.cnf" and then for a second match . "ok:" and

I need to find two matches in the output from ps. I am searching with ps -ef |grep mysql for: my.cnf /bin/sh /usr/bin/mysqld_safe --defaults-file=/data/mysql/master/agis_core/etc/my.cnf after this match I want to search back and match the hostname which is x number of lines back, above the... (2 Replies)
Discussion started by: bash_in_my_head
2 Replies
opx25(1M)																 opx25(1M)

NAME
opx25 - execute HALGOL programs SYNOPSIS
scriptname] char] file-descriptor] file-descriptor] string] DESCRIPTION
The commands, including are targeted for removal from HP-UX; see the below. HALGOL is a simple language for communicating with devices such as modems and X.25 PADs. It has simple statements similar to and that are described below. Options recognizes the following options: Causes to read script as the input program. If is not specified, reads the standard input as a script. Causes to use char as the first character in the input stream instead of actually reading it from the input descriptor. This is useful sometimes when the program that calls is forced to read a character but then cannot ``unread'' it. Causes to use number for the output file descriptor (i.e., the device to use for The default is 1. Causes to use 'number' for the input file descriptor (ie, the device to use for 'expect'). The default is 0. Causes to save this string for use when is encountered in a command. Causes to turn on debugging mode. Causes to turn on verbose mode. An script file contains lines of the following types: (empty) Empty lines are ignored. Lines beginning with a slash are ignored (comments) ID ID denotes a label, and is limited to alphanumerics or string must be surrounded by double quotes. The text is sent to the device specified by the option. Non-printable charac- ters are represented as in C; i.e., as DDD, where DDD is the octal ascii character code. in a send string is the string that followed the option. Send a break "character" to the device. Here number is how many seconds to wait before giving up. 0 means wait forever, but this is not advised. Whenever string appears in the input within the time allotted, the command succeeds. Thus, it is not necessary to specify the entire string. For example, if you know that the PAD will send several lines followed by an prompt, you could just use as the string. The program etc.) is run with the args specified. Do not use quotes here. Also, the program is invoked directly (using so wild cards, redirection, etc. are not possible. If the most recent expect or run encountered an error, go to the label ID. Similar to but does not fork. Similar to but goes to standard error instead of to the device. Sets the program in debug mode. It echoes each line to as well as giving the result of each expect and run. This can be useful for writing new scripts. The command disables this feature. Sends subsequent incoming characters to This can be used in the file as a security measure, because part of the incoming data stream contains the number of the caller. There is a similar feature in it writes the time and the login name into the same logfile. The command disables this feature. Similar to but better in some cases because it sends only digits to the log file, and not other characters. The command dis- ables this feature. Sets a global timeout value. Each expect uses time in the timeout reservoir; when this time is gone, the program gives up (exit 1). If this com- mand is not used, there is no global timeout. Also, the global timeout can be reset any time, and a value of 0 turns it off. Exits with this value. 0 is success; anything else is failure. To perform a rudimentary test of configuration files, run by hand, using the option followed by the name of the script file. then sends to standard output and expects from standard input; thus you can type the input, observe the output, and use the command to see messages. See the file for a good example of HALGOL programming. WARNINGS
Use of commands, including is discouraged because they are targeted for removal from HP-UX. Use ftp(1) or rcp(1) instead. AUTHOR
was developed by HP. SEE ALSO
getx25(1), uucp(1). TO BE OBSOLETED opx25(1M)
All times are GMT -4. The time now is 11:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy