Sponsored Content
Top Forums Shell Programming and Scripting Injecting into shell history with perl? Post 302525050 by siegfried on Wednesday 25th of May 2011 01:41:46 PM
Old 05-25-2011
Injecting into shell history with perl?

How do I determine what my default shell is? If I'm root, how do I determine what my user's default shell is?

I think I'm running bash by default.

How do I write a perl program that can inject history into the shell's history so it can be retrieved with the history | grep command?

I have an old fashioned console (non-GUI) style perl program that asks dozens of questions. Incorporating readline might mitigate this a bit. What I would like to do is enhance the logic of this program to check ARGV before prompting the console (user) for information and then, after all the questions have been answered, artificially inject the completed command line into the shell history so the command can be re-run again with identical inputs by just hitting the up-arrow. This will save them from having to type all that stuff in again.

Can this be done?
Thanks!
Siegfried
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

korn shell script to keep history of same file

Hello, How do I write a korn shell that will rename file with the current date. What I want to do is, I have a file that is re-written every day. But instead, I want to keep a 14 day history of the file. So I want to write a script that will rename the current file with a date attached to the... (2 Replies)
Discussion started by: watson2000
2 Replies

2. HP-UX

shell history

When I try to run previous commands from the shell history, some irrelevent output is given (something like a script coding). What is the reason for this? (1 Reply)
Discussion started by: sube
1 Replies

3. Shell Programming and Scripting

injecting new line in sed substitution (hold space)

Morning, people! I'd like to call upon your expertise again, this time for a sed endeavor. I've already searched around the forums, didn't find anything that helped yet. background: Solaris 9.x, it's a closed system and there are restrictions to what is portable to it. So let's assume I... (4 Replies)
Discussion started by: ProGrammar
4 Replies

4. Programming

Unix shell with history features like in bash

hii to all i am developing a simple unix shell in c i want to add history feature in that how could i do that plz help if there is any tutorial or website plz put it here history feature should be like that in bash, when press up key show the previous command typed in console plz be... (1 Reply)
Discussion started by: vipin_jss
1 Replies

5. UNIX for Advanced & Expert Users

History to Another file [local user history , but root access]

Hi all, My need is : 1. To know who , when , which command used. 2. Local user should not delete this information. I mean , with an example , i can say i have a user user1 i need to give all the following permissions to user1, : a. A specific directory other than his home... (3 Replies)
Discussion started by: linuxadmin
3 Replies

6. UNIX for Dummies Questions & Answers

History to Another file [local user history , but root access]

Hi all, My need is : 1. To know who , when , which command used. 2. Local user should not delete this information. I mean , with an example , i can say i have a user user1 i need to give all the following permissions to user1, : a. A specific directory other than his home... (1 Reply)
Discussion started by: sriky86
1 Replies

7. UNIX for Dummies Questions & Answers

How to make each login shell history independent for same account?

Hello All, Many developers in our company use same application account to log in Linux Box for code development, how can i redirect my log in shell history to a different file to avoid history being shown to others or accidentally execute the same command which i or others executed? Thank you. (4 Replies)
Discussion started by: Ariean
4 Replies

8. Shell Programming and Scripting

Converting shell to Perl I run into shell built in function trap and need alternative in Perl

I am working on converting shell to Perl script. In shell we have built in function trap Do you know alternative in Perl or actually we don't need it? Thanks for contribution (3 Replies)
Discussion started by: digioleg54
3 Replies
All times are GMT -4. The time now is 05:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy