shell script何控制外面? - Linux

William avatar
By William
at 2016-08-18T22:21

Table of Contents


如題 shell script要如何對外面有作用


好比我這樣寫test.sh

#!bin/sh
cd ..
cd ..
cd ..

然後執行bash test.sh

沒有任何事情發生

--
作者: fleece (...) 看板: KoreanPop
標題: [問題] 請問一個叫O.S.T的歌手
時間: Fri Feb 19 12:25:09 2016

--
Tags: Linux

All Comments

Tom avatar
By Tom
at 2016-08-23T04:59
. test.sh
Edward Lewis avatar
By Edward Lewis
at 2016-08-24T12:45
因為你執行該 script 時候是建立另外一個 child process
去執行的,script 結束該 process 就結束,所以不會
改到 parent process 這個所在 shell 的環境
Joseph avatar
By Joseph
at 2016-08-29T09:11
若你要執行該 script 有該效果,就得強迫讓所在 shell
這個 process 來執行,一般 bash 可以用 source 或
. 這個命令以當下 shell 讀入執行就可以了
Lauren avatar
By Lauren
at 2016-08-31T15:09
比方 source xxxx.sh 這方式。一般用 source or .
主要大多用於載入/引入外部的 script 設定為主
Anonymous avatar
By Anonymous
at 2016-09-01T01:26
推kenduest詳解
Sierra Rose avatar
By Sierra Rose
at 2016-09-03T14:12
推推
Belly avatar
By Belly
at 2016-09-04T12:58
1樓簡答 2樓詳解 XDDD

字串比較問題求救

Connor avatar
By Connor
at 2016-08-17T21:45
版上大大大家好 小弟最近正在學習Linux中,但遇到了一個數值比對問題無法解決,懇請版上大大指點迷 津 game() { if [ -n and#39;echo ${_game_list} | grep -i and#34; POand#34;and#39; ]; then _game_id =PO ...

Linux 或開源多人開發運作模式

Mary avatar
By Mary
at 2016-08-17T21:31
不同公司團隊規模有不同的運作方式。 有些可能用跟 Subversion 一樣的方式,commit東西就push上去 所有東西交錯在一起。 複雜點可能就開 feature branch,東西做完自己 merge 回 master branch。 再複雜點可能就開始用 pull request,但是就要有人負 ...

Linux 或開源多人開發運作模式

Zora avatar
By Zora
at 2016-08-17T21:20
最近因為要用版本控制 Git Git 是 Linux發起人自已寫的版本控制軟體 現在Boss想要了解其運作方式 大致上的問題是這樣的,例如以Git Server為例 當一家公司很多人都央在自己PC開發完的版本 Commit到 Git Server時 如果一個版本剛好很多人在開發,不同時間Commit ...

apache 權限問題

Rebecca avatar
By Rebecca
at 2016-08-17T17:19
在 Linux 上傳了 laravel 專案,在 local 端執行 command line 都正常 使用 browser 打開就有 500 error,內容是使用 __DIR__.and#39;/../vendor/autoload.phpand#39; 時檔案不存在 排查一切確定檔案跟程式碼沒有問題以後 ...

win7連samba 顯示該IP拒絕連線

Donna avatar
By Donna
at 2016-08-17T16:02
server端使用 ubuntu 16.04 (64bit) client端使用 win7 (64bit) rootatkevin-ubuntu:/home/smbuser# smbclient -L //10.2.127.104 -U smbuser WARNING: The and#34;syslog ...