linux - ssh & 脚本问题

标签 linux ssh logging putty

我在执行 ssh 时遇到了一个奇怪的问题。我不确定 Unmatched ` 这个词是从哪里来的。我需要做的是运行脚本,将我在终端上所做的事情的信息记录到文本文件中。在 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 helpdesk@louisiana.edu.


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 的脚本时,您可以看到我收到的消息 - Script started, file is 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.
# -- jpd@usl.edu
    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

最佳答案

额外的 ` 似乎就在您的 .cshrc 的开头。

...当然,如果您正在按照您所说的运行 bash,则除外。 ps 的输出是什么?

关于linux - ssh & 脚本问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5367393/

相关文章:

linux - 编译错误 - Raspberry Pi 的内核源代码

git - 远程在 Git 服务器上创建一个裸仓库

python - python 3日志记录级别有什么区别?

java - Java 中每个应用程序使用一个记录器对象的性能

linux - 内核如何决定堆栈大小

linux - 运行 PHP Cli 时出现段错误

visual-studio-code - VScode SSH 扩展卡在安装步骤

node.js - 如何在node.js中登录网页?

linux - 通过 pulseaudio 通过 hdmi 的 DTS 或 AC-3 实时编码器

python - 使用python通过ssh捕获配置单元输出