Mimic bash history behavior


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Mimic bash history behavior
# 1  
Old 10-13-2005
Mimic bash history behavior

Does anyone know of a way to mimic the up arrow/down arrow type bash behavior within a shell script?

Say I have a scripted menu, and would like to be able to up arrow to bring up the last X number of lines of user input?

Thanks to anybody with a suggestion. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Different behavior between bash shell and bash script for cmd

So I'm trying to pass certain json elements as env vars and use them later on in a script. Sample json: JSON='{ "Element1": "file-123456", "Element2": "Name, of, company written in, a very weird way", "Element3": "path/to/some/file.txt", }' (part of the) script: for s... (5 Replies)
Discussion started by: da1
5 Replies

2. Shell Programming and Scripting

Cannot mimic the action of 'echo' with C

I realise this is not entirely a shell question because it involves the C language but it centers around a Bash script I have written. I have written a couple of bash script files that communicate via two serial ports. One script can be thought of as a receiver and the other as a transmitter.... (3 Replies)
Discussion started by: jjb
3 Replies

3. UNIX for Advanced & Expert Users

Bash : While Loop behavior

Good Morning I think there may be something I dont understand fully. The following code works well, but I dont like the set domen method. #!/bin/bash # domen="y" while do echo " M A I N - M E N U" echo "1. Contents of /etc/passwd" echo "2. List of users currently logged" echo... (10 Replies)
Discussion started by: popeye
10 Replies

4. UNIX for Advanced & Expert Users

unexpected behavior bash, set -o vi, history -a, and HISTFILE

I am trying to get my history in sync in multiple bash sections and things aren't working the way I expect. Desired behavior, hitting esc-K in all bash sessions (same userid and machine) will use the same history. Observed behavior: Esc-k shows the history of the current session, rather than... (8 Replies)
Discussion started by: gg48gg
8 Replies

5. Shell Programming and Scripting

bash history buffer cache

Moderators, Please excuse if I am in the wrong section. I have a question that someone may know the answer to. We know that a current bash shell keeps a record of all commands in a buffer. When the shell is terminated this buffer is written out to ~/.bash_history for the user. I know... (2 Replies)
Discussion started by: jaysunn
2 Replies

6. UNIX for Advanced & Expert Users

Different redirection behavior in BASH/Linux when run under cron vice login ???

run_xfs_fsr is a xfs filesystem maintenance script designed to run under cron. The system is a home theater personal computer running mythbuntu 10.10, and is accessed remotely for these tests. cron runs a script, (xfs_fsr.sh) at 02:30 that runs the subject script under BASH and sets the... (3 Replies)
Discussion started by: keepitsimpleeng
3 Replies

7. Red Hat

BASH command not found strang behavior

Hi all I am relatively new to linux (specifically red hat). I have installed Fedora 13 on my machine and started playing with the terminal when i found a very strange behavior when typing a command that is not found: the terminal does not prompt me back. In other words, i am logged as root (or... (4 Replies)
Discussion started by: abohmeed
4 Replies

8. UNIX for Dummies Questions & Answers

AIX bash history recall

Is it possible to use the keyboard UP ARROW in place of k to recall history? If so, how/what do I need to do change terminal emulation, etc.? TIA, George (7 Replies)
Discussion started by: gwfay
7 Replies

9. Shell Programming and Scripting

BASH quoting behavior

The block below isn't a surprise:$ ls file1 file2 file3 $ x=* $ echo $x file1 file2 file3 $ echo '$x' $x $ echo "$x" * $But I found this block a bit bewildering:$ echo $x' >' * $I'm wondering why substitution wasn't performed on the $x, since it was unquoted (as far as I can tell).... (5 Replies)
Discussion started by: na5m
5 Replies
Login or Register to Ask a Question
RBASH(1)						      General Commands Manual							  RBASH(1)

NAME
rbash - restricted bash, see bash(1) RESTRICTED SHELL
If bash is started with the name rbash, or the -r option is supplied at invocation, the shell becomes restricted. A restricted shell is used to set up an environment more controlled than the standard shell. It behaves identically to bash with the exception that the follow- ing are disallowed or not performed: o changing directories with cd o setting or unsetting the values of SHELL, PATH, ENV, or BASH_ENV o specifying command names containing / o specifying a filename containing a / as an argument to the . builtin command o specifying a filename containing a slash as an argument to the -p option to the hash builtin command o importing function definitions from the shell environment at startup o parsing the value of SHELLOPTS from the shell environment at startup o redirecting output using the >, >|, <>, >&, &>, and >> redirection operators o using the exec builtin command to replace the shell with another command o adding or deleting builtin commands with the -f and -d options to the enable builtin command o using the enable builtin command to enable disabled shell builtins o specifying the -p option to the command builtin command o turning off restricted mode with set +r or set +o restricted. These restrictions are enforced after any startup files are read. When a command that is found to be a shell script is executed, rbash turns off any restrictions in the shell spawned to execute the script. SEE ALSO
bash(1) GNU Bash-4.0 2004 Apr 20 RBASH(1)