[UCI-Linux] scp and .bashrc verbosity
Harry Mangalam
harry.mangalam at uci.edu
Wed Jun 17 10:03:49 PDT 2009
From the " ..so you won't mess up like I did" files..
I was playing around with my .bashrc to make it more useful for when I
logged in (automatically tell me what hosts on the cluster are down,
who's logged in, and what the Q status is.
That all worked fine, but I also found out that it interfered with
scp - when I tried to scp some files to that host, scp hung. In
debugging this problem, I eventually found out that .bashrc lines
that emit text can (and apparently do) interfere with scp (and other
processes that expect a mute shell response). So one example is to
put all your text-emitting stuff in a separate file and
execute that file only if you can detect a tty.
See: <http://defindit.com/readme_files/bash_examples.html>
ie hide the execution of that file inside a test like:
...
# yes we could do this in one line, but readability counts
interactive=`echo $- | grep -c i `
if [ ${interactive} = 1 ]; then
./whutsup.sh # where whutsup.sh emits all the text
fi
...
If there are more elegant ways of doing this, please let me know.
But it seems that snazzy prompt strings don't interfere with scp:
bash this (in one line)
PS1="\n\[\033[01;34m\]\t \[\033[01;32m\]\u@\[\033[01;31m\]\h:\[\033
[01;33m\]\w\n\! \$ \[\033[00m\]"
--
Harry Mangalam - Research Computing, NACS, Rm 225 MSTB, UC Irvine
[ZOT 2225] / 92697 949 824-0084(o), 949 285-4487(c)
MSTB=Bldg 415 (G-5 on <http://today.uci.edu/pdf/UCI_09_map_campus.pdf>
---
Education is the path from cocky ignorance to miserable uncertainty.
-- Mark Twain
More information about the UCI-Linux
mailing list