国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發(fā)設計 > 正文

如何在.cshrc中判斷是否在loginshell中?

2019-11-18 17:25:43
字體:
來源:轉載
供稿:網友
當有人這么問的時候,通常要問的是 

要如何判斷是否是一個 interactive shell? 或是問要如何判斷是否是 
最上層的 shell ? 

若你是要問 "是否在 login shell 中"(注:就是在做完 .cshrc 后,會 
再去做 .login),那么你也許用 "ps" 和 "$$" 隨便弄一弄,就能知道了 
。因為通常 login shells 的名字在 "ps" 看起來都是由 '-' 做開頭的。 
如果你是真的對另外兩個問題感興趣,那么這里有個方法可以讓你在 
.cshrc 中判斷。 

        if (! $?CSHLEVEL) then 
        # 
        # This is a "top-level" shell, 
        # perhaps a login shell, perhaps a shell started up by 
        # 'rsh machine some-command' 
        # This is where we should set PATH and anything else we 
        # want to apply to every one of our shells. 
        # 
            setenv CSHLEVEL 0 
            set home = ~username   # just to be sure 
            source ~/.env          # environment stuff we always want 
        else 
        # 
        # This shell is a child of one of our other shells so 
        # we don't need to set all the environment variables again. 
        # 
            set tmp = $CSHLEVEL 
            @ tmp  
            setenv      CSHLEVEL        $tmp 
        endif 

        # Exit from .cshrc if not interactive, e.g. under rsh 
        if (! $?PRompt) exit 

        # Here we could set the prompt or aliases that would be useful 
        # for interactive shells only. 

        source ~/.aliases
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 石台县| 佛学| 文水县| 焉耆| 永修县| 高唐县| 容城县| 舞阳县| 久治县| 霍林郭勒市| 威海市| 六安市| 唐山市| 安新县| 稷山县| 建宁县| 龙泉市| 元氏县| 沙洋县| 泸定县| 东莞市| 滦南县| 黄龙县| 岱山县| 罗甸县| 柳河县| 嘉定区| 柳林县| 临夏县| 昆明市| 剑川县| 晋江市| 镇巴县| 青浦区| 大庆市| 剑河县| 兴业县| 扎兰屯市| 莫力| 安化县| 宜黄县|