h******a 发帖数: 198 | 1 csh does support command history,
like !!,!n,!-n,!cmd
but not like bash/tcsh/ksh doskey style |
|
d******g 发帖数: 5 | 2 It is ksh, what is the precedure
from beginning to end, thanksssss! |
|
h******a 发帖数: 198 | 3 in sh/bash/ksh,
PS1="whateve U want"
in csh/tcsh
set prompt="whatever" |
|
s******n 发帖数: 2 | 4
我进入CXterm后,如果运行bash就不会有任何问题,因为我设好了.inputrc,但是我用的
是(系统管理员设的)ksh
好好读一下 ./doc/cxterm/CXTERM.FAQ----- |
|
|
B**z 发帖数: 153 | 6 my opion,
ksh is the best. |
|
B**z 发帖数: 153 | 7 #!/bin/ksh
if [ $# -lt 2 -o $# -gt 3 ];then
echo "Usage:$0 ext newext [path]"
exit 1
fi
if [ $# -eq 2 ];then
DIR=.
else
if [ -d $3 ];then
DIR=$3
else
echo "$3 does not exit."
exit 2
fi
fi
oldext=$1
newext=$2
((fileschanged=0))
files=$DIR/*.$oldext
for afile in $files;do
if [ -f $afile ];then
mv $afile ${afile%$oldext}$newext
((fileschanged=fileschanged+1))
fi
done
echo "$fileschanged \c"
if [ $fileschanged -gt 1 ];then
echo "files changed."
else
echo "file changed. |
|
|
h**h 发帖数: 132 | 9 that's definitely an alternative to tunnel xwindow traffic.
But since hundreds of users are used to telnet, and it's
expensive
to spend dollars for hundreds of licenses of ssh client
still looking for cheap solution.
there should be a simple script to identify whether it is
console login or not, if not, then decide where the user is
from, then define DISPLAY variable.
Any ideas? |
|
c*****t 发帖数: 1879 | 10 There is a way, but not very good.
1. get current tty
2. finger -l username | grep tty | cut fromremotesite
3. check if it is the console, setenv
p.s. last is not as good as finger. |
|
h**h 发帖数: 132 | 11 This doesn't work either, since most unix servers disable
finger server
well, the worst case is to write a shell script
to
1> who -m
user pts/9 Oct 20 17:35 (10.10.10.10)
2> parse info between ($REMOTEHOST)
3> See if it is from console or not
4> export DISPLAY=$REMOTEHOST:0.0
put that in .profile or .login? |
|
h**h 发帖数: 132 | 12 export REMOTEHOST="`who am i | sed -n 's/.*(\(.*\))/\1/p'`" |
|
m****m 发帖数: 165 | 13 You need to make sure the bash is installed in your
$HOME/bin/bash (I am sure you know).
If your system have already bash available (I know you have
'cause you can type bash after login), normally it will be
under /bin
Add following lines to your .profile and it will do the job
for you.
if [ -x /bin/bash ]; then
exec /bin/bash
fi
You can change to ksh & csh by this way as well. |
|
c*****t 发帖数: 1879 | 14 You should man csh/ksh/tcsh, depending on the shell
used. There, hit '/' key to do a search on 'FILE'.
That should immediately bring you to the files used.
Usually, the man page will tell you the exact order
of the files being processed. |
|
j***y 发帖数: 87 | 15 for csh, tcsh, .cshrc and .login are executed
for ksh, bsh, bash, .profile and .login are executed.
But I think bwang's question has some ambiguity. If he just wants to execute
some command once in one session, like xhost +font under an X environment,
then he shouldn't add entries in these startup files.
instead he should check what kind of session manager he is using and modify
the corresponding script, like .xsession and so on. |
|
c**t 发帖数: 2744 | 16 ps -aef | grep cogt
cogt 6998 6284 0 13:51:41 pts/38 0:00 server
cogt 6284 6281 0 13:28:04 pts/38 0:00 -ksh
cogt 7071 6284 0 13:53:46 pts/38 0:00 server 20089
cogt 7500 6284 0 14:06:40 pts/38 0:00 grep cogt
~
~
I try to kill -9 6998 7071.
What commandline can do this?
sed? awk? or make a program? |
|
s******n 发帖数: 15 | 17 sh, csh, ksh, bash, tcsh... what are the differences between
them? anyone can give some brief introdutions or suggest some
books on this topic. thanks. |
|
l*l 发帖数: 225 | 18 Why your program only cd some dir while not step out of them? |
|
y*y 发帖数: 4 | 19
Thank you very much.
Thanks,lul.
ypy |
|
i***f 发帖数: 10 | 20 shell commands are very powerful, like this:
find / -name bin -type d -print 2>/dev/null |
|
i***f 发帖数: 10 | 21 Thanks storm, your analyse is really good.
Sign, haven't using csh after getting used to ksh for a long time,
I am confused about ESC and TAB. Sorry for the wrong answer in
prevoius message. |
|
m****m 发帖数: 165 | 22 Normally /bin is a link to /usr/bin and ksh & sh are default
for Solaris. Only
when you need to use CSH, you need to edit /etc/shells.
When we have a root account, why should be add another one
to do the same job.
I guess whether to change root shell depends on personal
preference. At one
point I read a faq called 'root faq' and it is still
probably searchable on net.
I changed the root shell for myself because I have to do
many things as root
and it just doesn't make sense to work with sh mos |
|
m*****e 发帖数: 4193 | 23 bash is recommended. (what's bsh?) |
|
p**v 发帖数: 853 | 24 bsh is just the Bourne shell which is normally called
the shell, and i know that bash should be Bournce Again
shell which is not available in my system(solaris). it is
said that bash is available to linux only and i do not know
if this is true nowadays. |
|
A***e 发帖数: 130 | 25
available on Solaris now |
|
m*****e 发帖数: 4193 | 26
I am confused. bash was first on Unix and ported to Linux.
I still remember when Linus Torvalds announced his first version of Linux,
he said "bash works now" :-) |
|
m*****e 发帖数: 4193 | 27
That's sh. I still don't know what bsh is :-)
You have a weird Solaris system :-) |
|
A***e 发帖数: 130 | 28
bash is from GNU, do not know Linux or other Unix first... |
|
c**t 发帖数: 2744 | 29 【 在 ferry (死菜了) 的大作中提到: 】
for i in 0 1 2 3 4 5 6 7 8 9;
do
print Hello;
done
2) When I try to do this:
set float=2.3
echo $1
man ksh |
|
ft 发帖数: 106 | 30 tcsh, bash, ksh......
a lot of shells do that. If you are root on your machines, edit your
/etc/passwd file. :-) |
|
m******n 发帖数: 497 | 31 some Unix allow you change yourself using chsh command
In some ksh, ESC key will active your command line editor(vi for example),
you can using vi command key stroke to go back/forward and do any editing.
ESC twice will do the complete command line with filename |
|
m******n 发帖数: 497 | 32 #!/bin/ksh
fullpath=/home/username/config.cfg
filename=${fullpath##*/}
echo $filename
withoutext=${filename%.cfg}
echo $withoutext |
|
j***n 发帖数: 9 | 33 Thanks, guys, here is another solution
#!/bin/ksh
namein=$1
basein=`basename ${namein}` #the baseline command will
remove the path
nameout=${basein%.cfg}
echo $nameout
It is really cool to have so may High-hands here. |
|
B**z 发帖数: 153 | 34 bash has similar features too. and some Ksh too, but the key-stroke is
different, you need to press ESC twice to into command line editor,
or Esc once to complete commmand line(i.e. auto complete the file name) |
|
l*****g 发帖数: 124 | 35 KSH:
if [[ -z $str ]]; then
...
fi |
|
f****n 发帖数: 4615 | 36
a, ksh
b, csh
c, sh
那个是? |
|
o***z 发帖数: 133 | 37 If you don't disable file name substitution of your shell,
it will interpolate your input of "*.h".
under ksh with -f flag,
ff *.h recon
should work |
|
m****m 发帖数: 165 | 38 Using ksh, writing a script to parse each line in /etc/passwd.
Using 'cut' or 'awk' to get the field (such as uid, gid...), compare with what
you get from running 'ls', output inconsistancy to a file.
For directory ownership, you might just compare it as a string. |
|
r*****s 发帖数: 985 | 39 I don't know much about KSH, but I think it is basically the same:
% echo `ssh username@hostname -x "command line"` |
|
b**********e 发帖数: 13 | 40 Could someone tell how to use ftp to in Korn Shell Scripts?
Thx! |
|
k**e 发帖数: 86 | 41 what
for example, what /usr/bin/ksh |
|
l******t 发帖数: 108 | 42 echo $shell
is that what you want?
just checked, only works for csh and tcsh, not for ksh, sh.
don't know about others. |
|
B**z 发帖数: 153 | 43 some ksh too,
Esc-k or something similar to invoke commad-line editor(can be set as
vi or emacs) |
|
t*u 发帖数: 186 | 44 i commented out "GetDate ()" and "{}", made it into a script, it works
correctly on my machine. |
|
c**t 发帖数: 2744 | 45 Did you change your system date to 11/01/2003 or 10/01/2003?
As I stated it works fine except the last day of a month. |
|
t*u 发帖数: 186 | 46 yea, set the date to 10/01/2003, it prints "2003930". |
|
b***l 发帖数: 15 | 47 In this script:
for i in 1 2 3 4; do echo $i; done
It will print 1 2 3 4. But if I want to loop from 1 to N which is very large,
e.g, 100000, how to do that in bash or ksh using "for" loop? Is there anything
like "for i in 1:10000"? This one does not work.
3x |
|
c*****t 发帖数: 1879 | 48 echo reformat output to single spaced. I often use it to strip spaces. |
|
c**t 发帖数: 2744 | 49 如果将 echo 换成 printf 也不行呀 |
|
c**t 发帖数: 2744 | 50 答案找到
y=`func`
echo $y
这时echo为什么不重新格式化? |
|