maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   General (https://talk.maemo.org/forumdisplay.php?f=7)
-   -   [help] Xterm: How to save a command ? (https://talk.maemo.org/showthread.php?t=60085)

Kevstacey 2010-08-10 11:30

[help] Xterm: How to save a command ?
 
I searched round and couldnt find the appropriate place to ask.

Once ive run a command in xterm it sometimes remembers previous commands and when i open xterm and keep pressing the up key it shows a few previous commands.What can i type so it remembers a specific command when i open xterm?
e.g im running psx4m but it doesnt seem to keep that specific command in memory after running psx4m and closing xterm.

Any help appreciated:o

Marlon 2010-08-10 11:43

Re: [help] Xterm: How to save a command ?
 
If you type 'exit' at the prompt it will be there next time. If you hit the X it won't.

If you want to save it as a command you could create it as a script and then open Term and type ./myscript

To be further helpful if you need it:
type out the command with "echo " in front. Eg,
echo /the/full/command/typed here >psx4m.script

Then type chmod +x psx4m.script

So you can open a terminal and type ./psx4m.script

dchky 2010-08-10 11:46

Re: [help] Xterm: How to save a command ?
 
If you type 'history' (without the quotes) in your x-term, it'll pop up a list of the last 500 commands you've attempted to execute. Each one is numbered.

Say you scroll back in the list a bit and you see psx4m is number 437, in your x-term simply type:

!437 (and hit enter)

It'll run that command.

You can also create aliases in your shell config file - for bash it's .bashrc (if you are root), for the 'user' account I believe you can use .profile - though don't quote me on that : )

atilla 2010-08-10 12:15

Re: [help] Xterm: How to save a command ?
 
history didnt work for me:(

kaos_king 2010-08-10 15:15

Re: [help] Xterm: How to save a command ?
 
Quote:

Originally Posted by atilla (Post 781496)
history didnt work for me:(

+1

Even as root

manvik60 2010-08-10 15:34

Re: [help] Xterm: How to save a command ?
 
Command history is stored in .ash_history file.
To get command history, You can press Alt + up/down arrow to get the last command, but it has a limit of storing only last 15 commands. This has already been filed a bug for this.

j.s 2010-08-10 15:37

Re: [help] Xterm: How to save a command ?
 
Quote:

Originally Posted by dchky (Post 781462)
If you type 'history' (without the quotes) in your x-term, it'll pop up a list of the last 500 commands you've attempted to execute. Each one is numbered.

Say you scroll back in the list a bit and you see psx4m is number 437, in your x-term simply type:

!437 (and hit enter)

It'll run that command.

You can also create aliases in your shell config file - for bash it's .bashrc (if you are root), for the 'user' account I believe you can use .profile - though don't quote me on that : )

bash is not present on a new n900, It needs to be installed.

The default n900 shell only saves a few commands, and the history command is not a part of the default shell.

dchky 2010-08-11 09:41

Re: [help] Xterm: How to save a command ?
 
Quote:

Originally Posted by j.s (Post 781718)
bash is not present on a new n900, It needs to be installed.

The default n900 shell only saves a few commands, and the history command is not a part of the default shell.

Apologies, thanks for the correction, you are absolutely right - as is manvik60. I believe I was on autopilot when I noticed that and installed bash without even thinking about it. I like to live dangerous, on the N900 I do everything as root : )


All times are GMT. The time now is 02:52.

vBulletin® Version 3.8.8