Sponsored Content
Top Forums Shell Programming and Scripting Problem in sending inputs to format command using expect Post 302785931 by chidori on Tuesday 26th of March 2013 02:25:29 PM
Old 03-26-2013
Problem in sending inputs to format command using expect

Hi ,

I am not able figure out how to use expect tool to send input to this prompt of format

Code:
Searching for disks...done
selecting c0t3d0
[disk formatted]


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format>

my try
Code:
spawn "format -d c0t3d0"
expect "*format>*"  # I feel something is wrong over here
send "partition/r"

Please help
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with mailx command when sending attachment.

Hi, I have tried to sent a mail with body and attachment. But the shell script got hanging while executing that command. The command is "(cat body;uuencode att1.csv)|mailx -s "Production Monitoring Report(Unix Side)" milton.yesusundaram@patni.com" where body is a file having a single line.... (2 Replies)
Discussion started by: miltony
2 Replies

2. Shell Programming and Scripting

Checking the format of inputs in a file

Hi, I have a script that takes the contents of another file as inputs. Its assumed that there are 3 values in the input file that are seperated by '|'. I have to check in my script, whether the filed seperator used in the input file is '|' or not. If its not a '|' I have to print a error... (13 Replies)
Discussion started by: sendhilmani123
13 Replies

3. UNIX for Advanced & Expert Users

better format for sending mail

i am using a script to create a file which contains the mail to be sent.in every steo this file grts appended through out the script using several variables.now i want to convert it into html format so that the mail will have better look and feel and the font color and size can be changed. i tried... (3 Replies)
Discussion started by: dr46014
3 Replies

4. Shell Programming and Scripting

Problem with while reading HTML inputs

Hi All, I am not able to read my HTML form inputs properly in my script. I have a textarea in my form where user needs to enter sql query... but when user enter query like below : select * from order_queue where NUM_OF_PICKUP >=3 and TRANSACTION_TYPE=4 ; its coming like : select 171_arc... (3 Replies)
Discussion started by: askumarece
3 Replies

5. Shell Programming and Scripting

Expect: run a command first before sending

Hello Expect experts, Is it possible with Expect to run a command first when an expected phrase is outputted by a spawned program? Before sending an answer to the spawned program that is... Thanks a lot. (2 Replies)
Discussion started by: Tr00tY
2 Replies

6. Shell Programming and Scripting

Query on sending inputs to a running application

Hi I need a help for below : I am running an application XXXX , and when it starts i am passing a file name called "connect.spb" and after the application connects to the server i am sending filename "accept.spb" as a parameter. DL385:$ ./XXXX This is XXXX (Reproducer by Order or RelaY) ... (1 Reply)
Discussion started by: srkelect
1 Replies

7. Shell Programming and Scripting

Sending test pass to a folder in expect

still new to this expect useing bach shell to cammand expect script i tink i have that right! i want to have the test im running upon every complted cycle copyed to a folder. cant seem to get it to work. Ive tryed log_file -a $globallogdir/deveoper.log proc dbglog {notsure what... (0 Replies)
Discussion started by: melvin
0 Replies

8. Shell Programming and Scripting

Expect Script sending password with $ and symbols

All, I am trying to use expect to send SFTP password because I am unable to share a key with the vendor. They gave me a password that uses some symbols in it like $ and ! When i try to use the send command in expect it thinks the $ is a variable. Is there anyway to have it send the... (2 Replies)
Discussion started by: markdjones82
2 Replies

9. Shell Programming and Scripting

sending content of a file in Expect

How Can I send the content of a file in Expect? Do I have to use cat command in a way? if yes how? lets say my file is called 1.txt. example: expect "Enter command to send:" {send "???? \r"} ???? --> content of the file 1.txt (1 Reply)
Discussion started by: alireza6485
1 Replies

10. Shell Programming and Scripting

problem in automating "fdisk" command using send and expect

hi i want to automate fdisk command . i spawned a process containing fdisk command from a process and tried to send the options to fdisk promt from that process. but that spawed process is notstarting itself help me out trying for two days :wall: my code: #!/bin/bash echo... (5 Replies)
Discussion started by: jagak89
5 Replies
addbadsec(1M)						  System Administration Commands					     addbadsec(1M)

NAME
addbadsec - map out defective disk blocks SYNOPSIS
addbadsec [-p] [ -a blkno [blkno...]] [-f filename] raw_device DESCRIPTION
addbadsec is used by the system administrator to map out bad disk blocks. Normally, these blocks are identified during surface analysis, but occasionally the disk subsystem reports unrecoverable data errors indicating a bad block. A block number reported in this way can be fed directly into addbadsec, and the block will be remapped. addbadsec will first attempt hardware remapping. This is supported on SCSI drives and takes place at the disk hardware level. If the target is an IDE drive, then software remapping is used. In order for software remapping to succeed, the partition must contain an alternate slice and there must be room in this slice to perform the mapping. It should be understood that bad blocks lead to data loss. Remapping a defective block does not repair a damaged file. If a bad block occurs to a disk-resident file system structure such as a superblock, the entire slice might have to be recovered from a backup. OPTIONS
The following options are supported: -a Adds the specified blocks to the hardware or software map. If more than one block number is specified, the entire list should be quoted and block numbers should be separated by white space. -f Adds the specified blocks to the hardware or software map. The bad blocks are listed, one per line, in the specified file. -p Causes addbadsec to print the current software map. The output shows the defective block and the assigned alternate. This option cannot be used to print the hardware map. OPERANDS
The following operand is supported: raw_device The address of the disk drive (see FILES). FILES
The raw device should be /dev/rdsk/c?[t?]d?p0. See disks(1M) for an explanation of SCSI and IDE device naming conventions. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Architecture |x86 | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
disks(1M), diskscan(1M), fdisk(1M), fmthard(1M), format(1M), attributes(5) NOTES
The format(1M) utility is available to format, label, analyze, and repair SCSI disks. This utility is included with the addbadsec, diskscan(1M), fdisk(1M), and fmthard(1M) commands available for x86. To format an IDE disk, use the DOS "format" utility; however, to label, analyze, or repair IDE disks on x86 systems, use the Solaris format(1M) utility. SunOS 5.10 24 Feb 1998 addbadsec(1M)
All times are GMT -4. The time now is 05:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy