Sponsored Content
Top Forums Shell Programming and Scripting Creating a command history feature in a simple UNIX shell using C Post 94568 by blowtorch on Sunday 1st of January 2006 01:42:48 AM
Old 01-01-2006
I suggest that you maintain a history file to keep track of the past commands, something like what ksh maintains. The file is .sh_history or something similar in the user's home directory. There is another thing that you would have to do, and that is have an escape sequence by which the user enters the history mode. Ksh in vi mode uses Esc to enter the command mode; you have to use something similar.
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

how unix stores command history

Hi techies, I have a doubt upon the command history utilities in Unix ... As far as I know, history stores the event number and command for upto that many number of previous commands executed in the HISTSIZE variable ... my doubt here is can we get the time in which these commands were... (3 Replies)
Discussion started by: Sabari Nath S
3 Replies

2. Solaris

unix command history

is there any way to determine the last command entered on a unix machine??? Thanx (3 Replies)
Discussion started by: mm00123
3 Replies

3. Shell Programming and Scripting

Creating simple shell program

Hi, I'm new to UNIX shell programming... can anyone help in doing the following : 1) create a text file named "Model File" having following columns : Name Number Physics Chemistry 2) prompt user to n rows enter the name, number, physics ,chemistry 3) display the entire columns and rows... (1 Reply)
Discussion started by: Mayuri P R
1 Replies

4. UNIX for Dummies Questions & Answers

History feature in Unix

Hi, I'm working on two flavours of unix namely HP-UX and sun solaris. In HP-UX, for executing the previous commands, i use the arrow keys. But on sun solaris this is not working. Can anyone explain how to use history feature effectively in sun solaris os? Thanks (4 Replies)
Discussion started by: venkatesht
4 Replies

5. 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

6. Shell Programming and Scripting

how to execute ksh simple shell script without creating .sh file

please help me to execute a simple shell script like for i in `ls echo $i done . i dont want to create a new sh file to execute it. Can i just type and execute it ? because I always this kind of simple for loops . Please help . Thanks (7 Replies)
Discussion started by: Sooraj_Linux
7 Replies

7. Shell Programming and Scripting

UNIX CO command for file version history

Hello :) I'm a newb when it comes to shell scripting and was wondering about a command(s) for a script that could be used to checkout a certain number of version/revision histories of a file. I know for the latest revison you "co filename" or for a certain revision number "co -r*.* filename"... (2 Replies)
Discussion started by: MN-DBA
2 Replies

8. Homework & Coursework Questions

Help with creating a simple shell script

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write a shell script that accepts two arguments. The two arguments are the name of 2 files. • If the arguments... (3 Replies)
Discussion started by: Scripter12345
3 Replies

9. What is on Your Mind?

The Great History of UNIX (1969-1999) | 30 Years of UNIX History | YouTube Video

I am pleased to announce this new video in 1080 HD for UNIX lovers honoring thirty years of UNIX history spanning from 1969 to 1999 presented in 150 seconds (two and a half minutes) in 1080 HD, celebrating the 50th anniversary of UNIX. The Great History of UNIX (1969-1999) | 30 Years of UNIX... (8 Replies)
Discussion started by: Neo
8 Replies
Tcl_RecordAndEvalObj(3) 				      Tcl Library Procedures					   Tcl_RecordAndEvalObj(3)

__________________________________________________________________________________________________________________________________________________

NAME
Tcl_RecordAndEvalObj - save command on history list before evaluating SYNOPSIS
#include <tcl.h> int Tcl_RecordAndEvalObj(interp, cmdPtr, flags) ARGUMENTS
Tcl_Interp *interp (in) Tcl interpreter in which to evaluate command. Tcl_Obj *cmdPtr (in) Points to a Tcl object containing a command (or sequence of commands) to execute. int flags (in) An OR'ed combination of flag bits. TCL_NO_EVAL means record the command but don't evaluate it. TCL_EVAL_GLOBAL means evaluate the command at global level instead of the current stack level. _________________________________________________________________ DESCRIPTION
Tcl_RecordAndEvalObj is invoked to record a command as an event on the history list and then execute it using Tcl_EvalObjEx (or Tcl_Global- EvalObj if the TCL_EVAL_GLOBAL bit is set in flags). It returns a completion code such as TCL_OK just like Tcl_EvalObjEx, as well as a result object containing additional information (a result value or error message) that can be retrieved using Tcl_GetObjResult. If you don't want the command recorded on the history list then you should invoke Tcl_EvalObjEx instead of Tcl_RecordAndEvalObj. Normally Tcl_RecordAndEvalObj is only called with top-level commands typed by the user, since the purpose of history is to allow the user to re- issue recently-invoked commands. If the flags argument contains the TCL_NO_EVAL bit then the command is recorded without being evaluated. SEE ALSO
Tcl_EvalObjEx, Tcl_GetObjResult KEYWORDS
command, event, execute, history, interpreter, object, record Tcl 8.0 Tcl_RecordAndEvalObj(3)
All times are GMT -4. The time now is 07:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy