ssh 和脚本问题
我在执行 ssh 时遇到了一个奇怪的问题。我不确定无与伦比的`这个词是从哪里来的。我需要做的是运行脚本,将我在终端上执行的操作的信息记录到文本文件中。 ssh 之后 -
Sun Microsystems Inc. SunOS 5.8 Generic Patch October 2001
This is /etc/motd, last updated 3 Feb 2003.
To learn about the UCS system and other aspects of computing at UL-Lafayette
visit our home page http://helpdesk.louisiana.edu/ .
For more information about system use, contact the Help Desk, Stephens
Hall, Room 201, 482-5516 (x25516), during normal UL office hours; or send
e-mail to [email protected].
ATTENTION:
Unsecure Telnet and FTP will be turned off soon.
Please make arrange to use ssh or sftp.
Putty(telnet) and WinSCP(ftp) would be a good replacement.
Unmatched `
d13.ucs.louisiana.edu% bash
bash-2.04$ script -a myInformation.txt
Script started, file is myInformation.txt
Unmatched `
d13.ucs.louisiana.edu%
当我尝试启动名为 myInformation.txt 的脚本时,您可以看到我收到的消息 - 脚本已启动,文件为 myInformation.txt
。但正如您所注意到的,我再次收到消息 Unmatched ` 并且来自 bash。问题是什么 ?任何建议的见解都会非常好。
注意:名为 myInformation.txt 的文件正在创建,但没有任何内容进入其中。因为我什至尝试运行某些命令,例如 ls
,然后使用 ctrl+d 退出脚本。但当我打开文件时,什么也没有。
.cshrc
`# @(#)cshrc 1.11 89/11/29 SMI
if ( `uname -s` == "Linux") then
# /etc/csh.{cshrc,login} set the csh and tcsh environments for Linux
# We just modify a few here:
set history=20 savehist=20
exit 0
endif
umask 027
# add here additional directories
set lpath = ()
set path = (~ ~/bin $lpath /usr/local/bin /usr/ccs/bin /usr/dt/bin /usr/openwin/bin /usr/bin /usr/sbin /usr/ucb .)
unset lpath
set noclobber
# Comment out the next line if you WANT core dumps (to debug via dbx,adb,gdb...)
limit coredumpsize 0
# An alternative to the above is to symlink ~/core to /dev/null ....
# Note that a core file can put you over quota, necessitating a command-line
# login [pick from the CDE Options menu] to be able to remove it.
if ( $?prompt == 0) exit
# Put here cmds suitable just for interactive c-shells
set history=20 savehist=20 time=10 autologout=28800
#set ignoreeof
set filec
set notify
#alias ls 'ls -F'
alias mail mailx
alias nissql /pkgs2/mysql/bin/mysql -h calvados.ucs.louisiana.edu -u cs4601d -p cs4601_d
.login
# @(#)local.login 1.5 98/10/03 SMI
if (`uname -s` == "Linux") then
exit 0
endif
if (! $?DT ) then
# Insert HERE and commands that are interactive, or alter the terminal
# characteristics. Thus, they will be bypassed if you start CDE and your
# .dtprofile invokes .login. Also remember /etc/.login is run first
# by non-CDE logins, and already sets some terminal characteristics.
# -- [email protected]
stty -istrip
endif
# environment variables
#setenv EXINIT 'set sh=/bin/csh sw=4 ai report=2'
#setenv MORE '-c'
#setenv PRINTER lw
setenv RNINIT '-I -e -m -S -i=11 -N -/ -h +hdate +hlines +hfrom -hdate-'
setenv LESS mQ
#setenv PRDEPT nnnn
setenv PAGER /usr/local/bin/less
#setenv EDITOR /usr/local/bin/emacs
setenv MANPATH /usr/local/man:/usr/local/perl/man:/usr/dt/man:/usr/openwin/man:/usr/man
#setenv AB2_DEFAULTSERVER http://pineau.ucs.louisiana.edu:8888/
setenv AB2_DEFAULTSERVER http://docs.sun.com:80/
setenv H_SPELL /dev/null
#
# if possible, start the windows system. Give user a chance to bail out
# To enable attempting openwin, set try_openwin=1 in the line below:
set try_openwin=0
if ( `tty` == "/dev/console" && $try_openwin) then
if ( "$TERM" == "sun" || "$TERM" == "sun-color" || "$TERM" == "AT386" ) then
if ( ${?OPENWINHOME} == 0 ) then
setenv OPENWINHOME /usr/openwin
endif
echo ""
echo -n "Starting OpenWindows in 5 seconds (type Control-C to interrupt)"
sleep 5
echo ""
$OPENWINHOME/bin/openwin
clear # get rid of annoying cursor rectangle
echo -n "Automatically logging out (type Control-C to interrupt)"
sleep 5
logout # logout after leaving windows system
endif
endif
unset try_openwin
I am having a strange problem while doing ssh. I am not sure where the term Unmatched ` is coming from. What I need to do is run script that logs information of what I am doing on the terminal to text file. After ssh -
Sun Microsystems Inc. SunOS 5.8 Generic Patch October 2001
This is /etc/motd, last updated 3 Feb 2003.
To learn about the UCS system and other aspects of computing at UL-Lafayette
visit our home page http://helpdesk.louisiana.edu/ .
For more information about system use, contact the Help Desk, Stephens
Hall, Room 201, 482-5516 (x25516), during normal UL office hours; or send
e-mail to [email protected].
ATTENTION:
Unsecure Telnet and FTP will be turned off soon.
Please make arrange to use ssh or sftp.
Putty(telnet) and WinSCP(ftp) would be a good replacement.
Unmatched `
d13.ucs.louisiana.edu% bash
bash-2.04$ script -a myInformation.txt
Script started, file is myInformation.txt
Unmatched `
d13.ucs.louisiana.edu%
When I tried to start the script with name myInformation.txt, you can see the message I am getting - Script started, file is myInformation.txt
. But again I am getting that message Unmatched ` and is coming out of bash, as you can notice. What is the problem ? Any insights suggested would be very great.
Note: file with name myInformation.txt is being created but nothing goes in to it. As I have even tried running certain commands like ls
and then exited the script with ctrl+d. But when I open the file, nothing is there.
.cshrc
`# @(#)cshrc 1.11 89/11/29 SMI
if ( `uname -s` == "Linux") then
# /etc/csh.{cshrc,login} set the csh and tcsh environments for Linux
# We just modify a few here:
set history=20 savehist=20
exit 0
endif
umask 027
# add here additional directories
set lpath = ()
set path = (~ ~/bin $lpath /usr/local/bin /usr/ccs/bin /usr/dt/bin /usr/openwin/bin /usr/bin /usr/sbin /usr/ucb .)
unset lpath
set noclobber
# Comment out the next line if you WANT core dumps (to debug via dbx,adb,gdb...)
limit coredumpsize 0
# An alternative to the above is to symlink ~/core to /dev/null ....
# Note that a core file can put you over quota, necessitating a command-line
# login [pick from the CDE Options menu] to be able to remove it.
if ( $?prompt == 0) exit
# Put here cmds suitable just for interactive c-shells
set history=20 savehist=20 time=10 autologout=28800
#set ignoreeof
set filec
set notify
#alias ls 'ls -F'
alias mail mailx
alias nissql /pkgs2/mysql/bin/mysql -h calvados.ucs.louisiana.edu -u cs4601d -p cs4601_d
.login
# @(#)local.login 1.5 98/10/03 SMI
if (`uname -s` == "Linux") then
exit 0
endif
if (! $?DT ) then
# Insert HERE and commands that are interactive, or alter the terminal
# characteristics. Thus, they will be bypassed if you start CDE and your
# .dtprofile invokes .login. Also remember /etc/.login is run first
# by non-CDE logins, and already sets some terminal characteristics.
# -- [email protected]
stty -istrip
endif
# environment variables
#setenv EXINIT 'set sh=/bin/csh sw=4 ai report=2'
#setenv MORE '-c'
#setenv PRINTER lw
setenv RNINIT '-I -e -m -S -i=11 -N -/ -h +hdate +hlines +hfrom -hdate-'
setenv LESS mQ
#setenv PRDEPT nnnn
setenv PAGER /usr/local/bin/less
#setenv EDITOR /usr/local/bin/emacs
setenv MANPATH /usr/local/man:/usr/local/perl/man:/usr/dt/man:/usr/openwin/man:/usr/man
#setenv AB2_DEFAULTSERVER http://pineau.ucs.louisiana.edu:8888/
setenv AB2_DEFAULTSERVER http://docs.sun.com:80/
setenv H_SPELL /dev/null
#
# if possible, start the windows system. Give user a chance to bail out
# To enable attempting openwin, set try_openwin=1 in the line below:
set try_openwin=0
if ( `tty` == "/dev/console" && $try_openwin) then
if ( "$TERM" == "sun" || "$TERM" == "sun-color" || "$TERM" == "AT386" ) then
if ( ${?OPENWINHOME} == 0 ) then
setenv OPENWINHOME /usr/openwin
endif
echo ""
echo -n "Starting OpenWindows in 5 seconds (type Control-C to interrupt)"
sleep 5
echo ""
$OPENWINHOME/bin/openwin
clear # get rid of annoying cursor rectangle
echo -n "Automatically logging out (type Control-C to interrupt)"
sleep 5
logout # logout after leaving windows system
endif
endif
unset try_openwin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
额外的 ` 似乎就在 .cshrc 的开头。
...当然,如果您像您所说的那样运行 bash,则除外。
ps
的输出是什么?The extra ` seems to be right there in the very beginning of your .cshrc.
...except of course if you are running bash as you say. What's the output of
ps
?