Sponsored Content
Full Discussion: Send keys in shell script
Top Forums Shell Programming and Scripting Send keys in shell script Post 303043874 by k_manimuthu on Monday 10th of February 2020 12:02:14 AM
Old 02-10-2020
Quote:
Do you need to exit vim?
Yes, i need to save the file content as well exit from current vi screen.

Quote:
But try to correct the workflow first and use other tools not editors in scripts in such way...
Can you show the code, perhaps a better way can be devised to make entire processing.
Considered the below sample codes did same as the real environment.
In real script i didn't have permission to change the file, so i am not able to change the workflow.
The script do lot of checks and finally create file by using vi command.
Currently the end user must type :wq! to save and exit the file, So the script move on next iteration.
I expected to find some solution to send keys to close that file and complete the script without manual intervention

Code:
#!/usr/bin/perl

### script name as test.pl and we doesn't have permission to modify that file.
### considered file1.txt is new file and it default text populated 
system("vi file1.txt");
### User manually save the file by using of :wq!. so it moves to next instruction in script

### considered file2.txt is new file and it default text populated 
system("vi file2.txt");
### User manually save the file by using of :wq!. so it moves to next instruction in script


### iteration going on Nth term
### considered file_n.txt is new file and it default text populated 
system("vi file_n.txt");
### User manually save the file by using of :wq!

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Send e-mail in Shell script

How to send an error mail from a shell script e.g. mail destination_adr@blabla.int "Message : here an error message " thanks, Ann. (1 Reply)
Discussion started by: annelisa
1 Replies

2. Shell Programming and Scripting

Shell script to send a mail

Hi , I need to prepare a script which will check my database with specific to particluar table. If the row count exceeds a certain limit, i need to send a mail to a set of Recipients. Being new to unix, please guide me to complete this task. Advance thanks, Sekar. (4 Replies)
Discussion started by: Sekar1
4 Replies

3. Shell Programming and Scripting

[Bash] Send Keys help

Hi all, I have programmed in VB before, and have recently moved on to Bash. In VB there is a command: SendKeys {F12} > "Show Help" SendKeys {Y} > "Answer Yes" Is there any way of doing this in Bash? (I need to send the Ctrl key into the script?) Thanks in advance (3 Replies)
Discussion started by: mikejreading
3 Replies

4. Shell Programming and Scripting

within shell script send expect and if else

Hi I have written one shell script , using that i am able to connect to remote machine but i have to #!/usr/bin/expect -f set address set username set password set OOLpath set dbusername set dbpasswd set tnsname set recdbusername set recdbpasswd set rectnsname spawn ssh... (1 Reply)
Discussion started by: mnmonu
1 Replies

5. Shell Programming and Scripting

within shell script send expect and if else

Hi, I have written one shell script , using that i am able to connect to remote machine but i have to #!/usr/bin/expect -f set address set username set password set OOLpath set dbusername set dbpasswd set tnsname set recdbusername set recdbpasswd set rectnsname spawn ssh... (2 Replies)
Discussion started by: mnmonu
2 Replies

6. Shell Programming and Scripting

How to send email through shell script

Hi All, I am new to the unix , i have to deliver one script very urgently I have to write a shell script where i have i want to send email to specific email id in this script i want FROM to be parameterized and stored in a variable TO to be parameterized and stored in a variable... (3 Replies)
Discussion started by: nileshbhawsar
3 Replies

7. Shell Programming and Scripting

Shell script for SFTP using Public and private keys

Hi all, I needed a shell script for file transfering using public/private keys for authentication. Could you please help me out on this? A procedure to write a shell script is enough. Thanks in advance. Regards. Vidya N (8 Replies)
Discussion started by: Vidya N
8 Replies

8. UNIX for Dummies Questions & Answers

How to send e-mail from shell script ( C shell )?

Hi , How to send e-mail from shell script ( C shell ) . Mailx command is not working ( It didn't giving error also ). Please help me (2 Replies)
Discussion started by: arukuku
2 Replies

9. Shell Programming and Scripting

To send a mail through shell script

I want to send a mail through shell script,If it is possible Please give me a code. mail id : upload.xxx@example.com (8 Replies)
Discussion started by: kannansoft1985
8 Replies

10. Shell Programming and Scripting

A shell script to run a script which don't get terminated and send a pattern from the output by mail

Hi Guys, I am very new to shell script and I need your help here to write a script. Actually, I have a script abc.sh which don't get terminated itself. So I need to design a script to run this script, save the output to a file, search for a given string in the output and if it exists send those... (11 Replies)
Discussion started by: Sambit Sahu
11 Replies
RSRCE(1)							 Debian GNU/Linux							  RSRCE(1)

NAME
rsrce - editor for raw MacOS resource forks SYNOPSIS
rsrce [-e] [-f script] [-o output-file] [input-file] DESCRIPTION
Rsrce is a command driven Macintosh resource fork editor for Unix-like operating systems. It works with raw resource forks stored in Unix files, such as the .rsrc files produced by the macutil package. Rsrce doesn't allow you to edit the resource data directly. It only knows to import/export them from/to files, performing conversion for the few resource types it knows. OPTIONS
-e When this option is given, the failure of an editor command will cause rsrce to quit immediately with a non-zero exit status. This is similar to the -e option to /bin/sh. -f script Instructs rsrce to read its commands from the given script, instead of using the standard input. -o output-file Specifies a default output file for the writecommand. Useful when calling rsrce scripts which save their changes with a write com- mand without a filename. If an input-file is specified, it is loaded before rsrce starts reading commands, and is used as the default output file if the -o option has not been given. USAGE
Rsrce reads commands from the standard input. Unquoted whitespace is ignored, except for the purpose of separating arguments. Empty lines are ignored, and a # at a position where an argument would have started indicates a comment which extends to the end of the line. Text within single quotes is used as-is. An unquoted backslash can be used the way it works in C strings, or to force literal interpretation of the following character. Resources are referred to by specifing their type and id, separated by a colon. I mean, something like "STR#:128". If the given type has less than 4 letters, spaces are added to complete it. The following commands are available: read [file] read the resources from file write [file] write the resources to file create resource create a new, empty resource with the given type and id delete resource remove the specified resource rename resource new-name change the name associated with resource to new-name chattr resource attr-spec change the attributes of resource according to attr-spec ls list each resource's type, id, attributes, data lenght, and name hexdump resource show an hexdump of resource's data import|export resource file [ext] import/export resource's data from/to file. The conversion which is performed depends on the extension of the given filename. This extenstion may be overriden by providing the extargument. edit resource[ext] invoke an external editor to change resource's data help list available commands exit terminate rsrce (without saving, use write before exit if you wish to save your changes) CONVERSION OF RESOURCE DATA
When rsrce imports or exports resource data, a conversion can be performed depending on the resource type and the extension of the provided filename. The following extensions are known to rsrce: bin causes no conversion, the raw resource data is used regardless of the resource type; txt causes the resource data to be converted to plain text. This is possible for STR, STR#andCMDLresources. BUGS
Rsrce has only been originally created to change the configuration of the miBoot Linux bootloader for OldWorld PowerMac computers. Since I do not use MacOS, I haven't tested any other usage of this program. You should therefore be very careful when using it, as it could very well produce unusable output. Another consequence of this is wildly missing functionnality. I'm not going to work on it, since I couldn't test anything in a real situa- tion. Patches and/or usage reports would be very welcome. AUTHOR
Jeremie Koenig <sprite@sprite.fr.eu.org> SEE ALSO
hfsutils(1), macutil(1) Debian Project 2004-03-26 RSRCE(1)
All times are GMT -4. The time now is 07:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy