Operating System - HP-UX
1826428 Members
3794 Online
109692 Solutions
New Discussion

Starting hpterm with automatic change to a specified directory

 
SOLVED
Go to solution
Hafner_1
New Member

Starting hpterm with automatic change to a specified directory

Hi,
I'm tired always to input 'cd verylongpathanddirectoryname' to change to a directory which I need very often.
To avoid this, I tried to write a script with a hpterm command using the options -e to start a subsequent script which execute cd, but this was not successful.
Who can help?
7 REPLIES 7
Mark Grant
Honored Contributor

Re: Starting hpterm with automatic change to a specified directory

I bet that was becuase you didn't get your script to start a new shell. If you really wanted it to you could have done

#!/bin/sh
cd /verylongplace
sh

That would probably work but never fear, aliases are here

alias "mycd=cd /extremelylongpath"

If you put the above in your .profile/.xsession/.anything that gets read before you login, you will be able to type "mycd" and you'll be there.
Never preceed any demonstration with anything more predictive than "watch this"
Dino_4
Frequent Advisor

Re: Starting hpterm with automatic change to a specified directory


Hi, how about putting 'cd /alongpathname' into your ~/.sh_rc or whatever shell u use!
G. Vrijhoeven
Honored Contributor

Re: Starting hpterm with automatic change to a specified directory

Hi,

Start the hpterm with the -ls option:

This option indicates that the shell that is started in the
hpterm window should be a login shell (i.e. the first
character of argv[0] will be a dash, indicating to the shell
that it should read the user's /etc/profile and .profile (for
ksh and sh) or /etc/csh.login and .login (for csh). This
option is ignored when the -e option is also used. Associated
resource: *loginShell.

and set the cd in the users .profile or set a var that inclustes this path.

HTH,

Gideon
Mark Greene_1
Honored Contributor

Re: Starting hpterm with automatic change to a specified directory

You can also add a cd to the directory at the end of your .Xsession file, so you will start there every time you log in.

mark
the future will be a lot like now, only later
Helen French
Honored Contributor

Re: Starting hpterm with automatic change to a specified directory

You can either write a simple script that does the 'cd' for you or setup a link in a convenient directory (fi that's a good option).

Another quick way is to complete your 'cd' command with the 'escape key' sequence. Instead of typing:

# cd verylongpathanddirectoryname

Type:

# cd ver (and press the escape key twice so that it will complete the rest of the directory or file name. If there is multiple entries start with the same string, this won't work unless you are more specific).

This is just a quick way of completing PATH and long file names.
Life is a promise, fulfill it!
Dietmar Konermann
Honored Contributor
Solution

Re: Starting hpterm with automatic change to a specified directory

Hmmm... you're talking about a script where you try to pass a new cwd via -e to an hpterm. Why don't you simply use:

#!/usr/bin/sh
cd verylongpathanddirectoryname && exec hpterm

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Chia-Wei
Advisor

Re: Starting hpterm with automatic change to a specified directory

1) Create a file say .alias.ksh
2) Input the directory that you want to cd to in the file. i.e alias longdir='cd verylongpathanddirectoryname'
3) Add this line in your .profile :
export ENV=.alias.ksh

With a new session, when you want to go to the long directory. Just type longdir!