質問編集履歴
1
あああああああああああああああああああああああああああああああああああああああああああああああああああああああ
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
apojjpjpojopopjゔぇあああああああああああ
|
test
CHANGED
@@ -1,56 +1 @@
|
|
1
|
-
```test.sh
|
2
|
-
|
3
|
-
HOST="xxx.xxx.xxx"
|
4
|
-
USER="test"
|
5
|
-
PASS="pass"
|
6
|
-
|
7
|
-
seasons[0]="Spring"
|
8
|
-
seasons[1]="Summer"
|
9
|
-
|
10
|
-
while read STR
|
11
|
-
do
|
12
|
-
hoge[$NO]=`echo $STR | cut -d , -f 1`
|
13
|
-
let NO++
|
14
|
-
done < csv/test.csv
|
15
|
-
|
16
|
-
#!/bin/sh
|
17
|
-
expect -c "
|
18
|
-
set timeout 5
|
19
|
-
spawn sftp -p $PORT $USER@$HOST
|
20
|
-
expect \"password\"
|
21
|
-
send \"${PASS}\r\"
|
22
|
-
|
23
|
-
set SUM 3
|
24
|
-
set i 0
|
25
|
-
|
26
|
-
while {\$i < ${SUM}} {
|
27
|
-
expect \"sftp\"
|
28
|
-
|
29
|
-
# ここでkeyを指定したい
|
30
|
-
|
1
|
+
apijoijioojoiああああああああああああああああああああああ
|
31
|
-
incr i 1
|
32
|
-
}
|
33
|
-
expect \"sftp\"
|
34
|
-
send \"exit\r\"
|
35
|
-
"
|
36
|
-
```
|
37
|
-
|
38
|
-
while文の中で$hogeの配列を順番に表示したいです。
|
39
|
-
インクリメントされる$iをキーにしたいのですが書き方がわからず困っています。
|
40
|
-
|
41
|
-
試したパターンは以下のとおりです
|
42
|
-
```
|
43
|
-
send \"puts ${seasons[0]}\r\"
|
44
|
-
Spring
|
45
|
-
|
46
|
-
send \"puts ${seasons[$i]}\r\"
|
47
|
-
Spring
|
48
|
-
Spring
|
49
|
-
(最初しか表示されない)
|
50
|
-
|
51
|
-
send \"puts ${seasons[\$i]}\r\"
|
52
|
-
syntax error: operand expected (error token is "$i")
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
```
|