Sponsored Content
Operating Systems Linux Hostname displays incorrectly Post 302147115 by bakunin on Sunday 25th of November 2007 04:14:59 AM
Old 11-25-2007
Quote:
Originally Posted by prowla
But that tends to fall apart if you use a different shell or terminal emulator.
This is simple to solve:

Code:
typeset HOST=$(hostname -s)

case $TERM in
     aixterm)
          PS1='^[];$LOGNAME@$HOST:$PWD^G^M# '
          ;;

     dtterm)
          PS1='^[]0;$LOGNAME@$HOST:$PWD^G^M# '
          ;;

     xterm)
          PS1='^[];$LOGNAME@$HOST:$PWD^G^M# '
          ;;


     vt100|ansi)
          PS1='$IFS$LOGNAME@$HOST:$PWD$IFS# '
          ;;

     *)
          PS1='$IFS$LOGNAME@$HOST:$PWD$IFS# '
          ;;

esac
export PS1

Notice, that the "^[", "^G" and "^M" are single characters, which have to be typed in via "CTRL-V".

bakunin
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Writing to a log file incorrectly

I have this script: #!/bin/ksh ######### Environment Setup ######### PATH=/gers/nurev/menu/pub/sbin:/gers/nurev/menu/pub/bin:/gers/nurev/menu/pub/mac :/gers/nurev/menu/adm/sbin:/gers/nurev/menu/adm/bin:/gers/nurev/menu/adm/mac:/ge... (5 Replies)
Discussion started by: heprox
5 Replies

2. UNIX for Dummies Questions & Answers

Solaris - unknown hostname - how can I change hostname?

Hello, I am new to Solaris. I am using stand alone Solaris 10.0 for test/study purpose and connecting to internet via an ADSL modem which has DHCP server. My Solaris is working on VMWare within winXP. My WinXP and Solaris connects to internet by the same ADSL modem via its DHCP at the same... (1 Reply)
Discussion started by: XNOR
1 Replies

3. UNIX for Dummies Questions & Answers

PATH variable set incorrectly?

I've noted that in order to use commands like ifconfig, I have to prefix the commands with the directory. /etc/profile shows that the paths should be part of the PATH environment variable; any idea where the bug is? :confused: # /etc/profile # System wide environment and startup... (1 Reply)
Discussion started by: jon80
1 Replies

4. UNIX for Dummies Questions & Answers

character displayed incorrectly by ftp

Hi there, I have a ftp server called atlantis. Because of the f...g french characters, I noticed something very weird. Depending on what program I use (ftp, lftp or ssh) the same character is displayed as three different ways. On my local computer, the file is correctly displayed as "modéles".... (1 Reply)
Discussion started by: chebarbudo
1 Replies

5. AIX

Command last displays wrong hostname

I faced an interesting problem on my AIX servers. When I checked last logins with command last I saw that hostnames are wrong. Let say, I made login from workstation xxxxx and with the command last I saw: root pts/2 yyyyy 5 jan 15:38 still logged in Ping xxxxx and ping... (3 Replies)
Discussion started by: giovanni
3 Replies

6. Emergency UNIX and Linux Support

HP UX - ILO Console hostname different than Machine Hostname...

Hi All, So we added a new HP-UX 11.31 machine. Copied OS via Ignite-UX (DVD)over from this machine called machine_a. It was supposed to be named machine_c. And it is when you log in...however when I'm in the ILO console before logging in, it says: It should say: What gives? And how do... (4 Replies)
Discussion started by: zixzix01
4 Replies

7. UNIX for Dummies Questions & Answers

Strings comparing incorrectly

Hello I'm very new to Linux and shell scripting so I only know basic stuff. I'm making a script with the purpose of finding the longest string or word in a file. Here's what I got so far: #!/bin/bash longest="" for i in $(strings -n $1); do if ] then longest=$i fi done echo $longest... (4 Replies)
Discussion started by: SCB
4 Replies

8. UNIX for Dummies Questions & Answers

Incorrectly using 'ls' in if/then alias

I have an alias defined in which I wish to print the contents of a specific directory using 'ls' based on the if/then condition. The if/then conditions are being correctly evaluated, and the 'ls <path>' result is correct (tested directly in a terminal) although for some reason it seems the 'ls... (4 Replies)
Discussion started by: coldcoffeecup
4 Replies

9. UNIX for Advanced & Expert Users

Hostname -f hostname: Unknown host

deleted (0 Replies)
Discussion started by: hce
0 Replies
APD_BREAKPOINT(3)							 1							 APD_BREAKPOINT(3)

apd_breakpoint - Stops the interpreter and waits on a CR from the socket

SYNOPSIS
bool apd_breakpoint (int $debug_level) DESCRIPTION
This can be used to stop the running of your script, and await responses on the connected socket. To step the program, just send enter (a blank line), or enter a php command to be executed. PARAMETERS
o $ debug_level -An integer which is formed by adding together the XXX_TRACE constants.It is not recommended to use MEMORY_TRACE. It is very slow and does not appear to be accurate. ASSIGNMENT_TRACE is not implemented yet.To turn on all functional traces (TIM- ING, FUNCTIONS, ARGS SUMMARY (like strace -c)) use the value 99 RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Typical session using tcplisten bash#tcplisten localhost 7777 APD - Advanced PHP Debugger Trace File --------------------------------------------------------------------------- Process Pid (6118) Trace Begun at Sun Mar 10 23:13:12 2002 --------------------------------------------------------------------------- ( 0.000000): apd_set_session_trace called at /home/alan/Projects/project2/test. php:5 ( 0.074824): apd_set_session_trace_socket() at /home/alan/Projects/project2/tes t.php:5 returned. Elapsed (0.074824) ( 0.074918): apd_breakpoint() /home/alan/Projects/project2/test.php:7 ++ argv[0] $(??) = 9 apd_breakpoint() at /home/alan/Projects/project2/test.php:7 returned. Elapsed ( -2089521468.1073275368) > statement: /home/alan/Projects/project2/test.php:8 > statement: /home/alan/Projects/project2/test.php:8 > statement: /home/alan/Projects/project2/test.php:10 >apd_echo($i); EXEC: apd_echo($i); 0 >apd_echo(serialize(apd_get_active_symbols())); EXEC: apd_echo(serialize(apd_get_active_symbols())); a:47:{i:0;s:4:"PWD";i:1;s:10:"COLORFGBG";i:2;s:11:"XAUTHORITY";i:3;s:14:" COLORTERM_BCE";i:4;s:9:"WINDOWID";i:5;s:14:"ETERM_VERSION";i:6;s:16:"SE SSION_MANAGER";i:7;s:4:"PS1";i:8;s:11:"GDMSESSION";i:9;s:5:"USER";i:10;s:5:" MAIL";i:11;s:7:"OLDPWD";i:12;s:5:"LANG";i:13;s:10:"COLORTERM";i:14;s:8:"DISP LAY";i:15;s:8:"LOGNAME";i:16;s:6:" >apd_echo(system('ls /home/mydir')); >apd_continue(0); PHP Documentation Group APD_BREAKPOINT(3)
All times are GMT -4. The time now is 04:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy