如何在shell脚本中将字符串拆分为数组?
我尝试过IFS='delimiter',它适用于循环,(for, while)但我需要一个来自该字符串的数组.
如何从字符串中创建数组?
谢谢!
如何将结果find $1放入数组?
在for循环中:
for /f "delims=/" %%G in ('find $1') do %%G | cut -d\/ -f6-
Run Code Online (Sandbox Code Playgroud) 我想用循环设置数组元素:
for i in 0 1 2 3 4 5 6 7 8 9
do
array[$i] = 'sg'
done
echo $array[0]
echo $array[1]
Run Code Online (Sandbox Code Playgroud)
所以它不起作用.如何..?
Javascript代码:
var a = (b) ? b : 40;
Run Code Online (Sandbox Code Playgroud)
它正在运行,只是NetBeans说:"使用||运算符(列[在哪里?])".我没有找到任何解释.
它是什么?
谢谢!
#!/bin/sh
param1=$1
param2=$2
recursive(){
mkdir -p $2
cd $1
for file in `ls $1`; do
[ $file = "." -o $file = ".." ] && continue
[ -d $file ] && recursive $1"/"$file $2"/"$file
[ -f $file ] && ln -s $1"/"$file $2"/"$file
done
}
recursive $param1 $param2
Run Code Online (Sandbox Code Playgroud)
如果我执行这个脚本,它会调用self(递归).为什么不扫描所有目录?
(对不起,我的英语很差)
我想在插入更多行之前创建一个触发器.在插入新数据之前,我想删除id的早期版本.
例如:
CREATE OR REPLACE TRIGGER mytableTrigger
BEFORE INSERT ALL ON mytable
BEGIN
DELETE FROM mytable WHERE column2 = fooId; --I want to get fooId in here.
END;
INSERT ALL
INTO mytable (column1, column2, column3) VALUES (Seq.nextval(), fooId, 'val1.3')
INTO mytable (column1, column2, column3) VALUES (Seq.nextval(), fooId, 'val2.3')
INTO mytable (column1, column2, column3) VALUES (Seq.nextval(), fooId, 'val3.3')
SELECT * FROM dual;
Run Code Online (Sandbox Code Playgroud)
如果它是一个简单的行级触发器,那么我可以使用:new.fooId获取fooId.但事实并非如此.那么,我可以获得或给出INSERT ALL Trigger的ID吗?
谢谢.
我想将表类型作为参数传递给过程.
create or replace package FOO is
type FOOTYPE is record (
FOOTYPE_A varchar2(5) null,
FOOTYPE_B varchar2(5) null,
FOOTYPE_C varchar2(5) null
);
type FOOTYPETABLE is table of FOOTYPE;
...
procedure sendNew (
table_a in FOOTYPETABLE
) is
a number;
begin
...
end sendNew;
...
end FOO;
declare
type bartabletype is table of FOO.FOOTYPE index by binary_integer;
bartable bartabletype;
begin
bartable(0).FOOTYPE_A := '';
bartable(0).FOOTYPE_B := '';
bartable(0).FOOTYPE_C := '';
bartable(1).FOOTYPE_A := '';
bartable(1).FOOTYPE_B := '';
bartable(1).FOOTYPE_C := '';
FOO.sendNew(bartable);
end;
Run Code Online (Sandbox Code Playgroud)
但甲骨文说: …