When used in conjunction with an NCL script, command line arguments can set a variable’s value, help determine initial conditions, and so forth:
% cat modelRun.ncl
begin
[...]
if (.not. isvar("nyrStrt")) then ; is nyrStrt on command line?
nyrSrt = 1960
end if
if (.not. isvar("nyrLast")) then ; is nyrLast on command line?
nyrLast = 2002;
end if
print(nyrStrt) ; for illustrative purposes
print(nyrLast)
[...]
end
(Variables nyrStrt and nyrLast are set on the command line)
% ncl nyrStrt=1900 nyrLast=1968 modelRun.ncl
Variable: nyrStrt
Type: integer
Total Size: 4 bytes
1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
(0) 1900
Variable: nyrStrt
Type: integer
Total Size: 4 bytes
1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
(0) 1968
Consider the following
ncl nyrStrt=1930 'fName="Model*"' gravity=9.8 opt=True cyclic=False latS=-30 latN=30 lonL=130 lonR=290 modelRun.ncl
When the number of CLOs is large, it might be clearer to enter only one or two per line. The Unix line continuation character, </b>, can be used to accomplish this:
ncl nyrStrt=1930 \
'fName="Model*"' \
gravity=9.8 \
latS=-30 latN=30 \
lonL=130 lonR=290 \
modelRun.ncl
equity n. 产权,股票; 公正
shift away 移走
box office 票房
The U.S. Federal Reserve 美联储
设想这样一个应用情景,需要下载一批文件,不想写循环或者文件名分散或随机的情况,拿到了枚举list,可以下了吧。当然,我们还需要wget 以及重命名等任务。也就是说,我们需要在每一行前面或者后面加上关键词,比如wget空格,或者其他什么的
vim可以很好解决这个问题,两个语句:
行首加入 :%s/^/Hello, this is your word/
行尾加入 :%s/$/Bye, this is your word/
CTRL+V 可以很好解决局部问题
或者
2-50行加入 :2,50 s/^/#/g