SunOS 5.10 "この" [冗長]

SunOS 5.10

私はSunOS 5.10システムへの(一般ユーザー)アクセス権を持っています。

/usr/bin/which破損しています(ブロックされています)。

システムに問題があることは明らかですが、rootアクセス権がない場合、実行できる操作は大幅に制限されます。 Ubuntuからコピーしようとしましたが、whichこれはSunOS 5.10では利用できない機能によって異なります。

$ md5sum /usr/bin/which
a39bb82e9e354c5b99e9e235a53c48d9  /usr/bin/which
$ uname -a
SunOS solaris 5.10 Generic_147147-26 sun4u sparc SUNW,Sun-Fire-V210 Solaris
$ bash --version
GNU bash, version 4.3.33(1)-release (sparc-sun-solaris2.10)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

whichこの古いシステムのコマンドはどこで見つけることができますか?

ベストアンサー1

このwhichコマンドは、Solaris 10では壊れる可能性はありません。それはscript1cshだけです。

このスクリプトの内容が実際に破損している場合は、次の行をコピーして貼り付けて置き換えることができます。これにより標準動作が復元されます。

#! /usr/bin/csh -f
#
# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved.  The Berkeley Software License Agreement
# specifies the terms and conditions for redistribution.
#
#ident  "%Z%%M% %I% %E% SMI"
#
#       which : tells you which program you get
#
# Set prompt so .cshrc will think we're interactive and set aliases.
# Save and restore path to prevent .cshrc from messing it up.
set _which_saved_path_ = ( $path )
set prompt = ""
if ( -r ~/.cshrc && -f ~/.cshrc ) source ~/.cshrc
set path = ( $_which_saved_path_ )
unset prompt _which_saved_path_
set noglob
set exit_status = 0
foreach arg ( $argv )
    set alius = `alias $arg`
    switch ( $#alius )
        case 0 :
            breaksw
        case 1 :
            set arg = $alius[1]
            breaksw
        default :
            echo ${arg}: "      " aliased to $alius
            continue
    endsw
    unset found
    if ( "$arg:h" != "$arg:t" ) then        # head != tail, don't search
        if ( -e $arg ) then         # just do simple lookup
            echo $arg
        else
            echo $arg not found
        set exit_status = 1
        endif
        continue
    else
        foreach i ( $path )
            if ( -x $i/$arg && ! -d $i/$arg ) then
                echo $i/$arg
                set found
                break
            endif
        end
    endif
    if ( ! $?found ) then
        echo no $arg in $path
    set exit_status = 1
    endif
end

exit ${exit_status}

ただし、中断のより一般的な原因は、which.txtファイルにリストされているディレクトリで使用されるファイルシステムの1つに問題があるためですPATH

これはNFSマウントが応答しないか、ローカルファイルシステムに問題がある可能性があります。

調査を開始する1つの方法は次のとおりです。このコマンドを実行し、どこで停止するかを確認してください。

csh -x /bin/which foo

停止が発生する可能性があるもう1つの理由は、ファイルがスクリプトの先頭で発生するため、whichファイルに問題があるためです。.cshrc

1 スクリプトなので設計上問題があると言うこともできます;-)cshwhich

おすすめ記事