Паша первый скрипт для курсача

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
sqlite3=`which sqlite3`
DB_FILE=/home/alexandra/Documents/myfirst.db
key=1
for file in `ls | grep 'cpp'`
do
$sqlite3 $DB_FILE "INSERT INTO pashatest (id, name) values($key, '$file')"
key=`expr $key + 1`
echo "$file"
done
$sqlite3 $DB_FILE "SELECT * FROM pashatest"