Fórum Ubuntu CZ/SK
Ubuntu pro osobní počítače => Software => Příkazový řádek a programování pro GNU/Linux => Téma založeno: Dimitrij Fedoryno 17 Ledna 2015, 14:01:07
-
Zdravím, potřeboval bych pomoci s jednoduchým bash scriptem..
#!/bin/bash
function compile()
{
cd /home/wow/srv/ggf
mkdir -p build
cd build
cmake /home/wow/srv/ggf/ -DPREFIX=/home/wow/srv/ggf/build/ -DLIBSDIR=/home/wow/libs/
make -j8
make install
}
function compile_to_file()
{
compile | lee ggf_compile.log
}
function compile_log_to_paste()
{
echo "INSERT INTO `pastebin`.`pastes` (`title`, `name`, `raw`) VALUES ('Gigafun Compile Log', 'Dway', 'LOAD_FILE('ggf_compile.log')');" | mysql -u trinity --password=trinity
}
compile_to_file
compile_log_to_paste
Script by měl zkompilovat jádro emulátoru a následně kompilaci zapsat do souboru.
Poté by měla další funkce zapsat obsah .log souboru z kompilace do databáze pastebin, tabulky pastes a do sloupce "raw".
Toť vše, co požaduju od scriptu.
Neměl by někdo nějaké adekvátní a hlavně funkční řešení. Tento script mi nefunguje.
-
1) asi misto "lee" myslis tee
2) pokud ti fungujou ty prikazy, tak je normalne dej do skriptu za sebe a bude to delat, co to ma delat ... nechapu problem
-
Problém je zde
ggf.sh: line 19: pastebin: command not found
ggf.sh: line 19: pastes: command not found
ggf.sh: line 19: title: command not found
ggf.sh: line 19: name: command not found
Cannot open master raw device '/dev/raw/rawctl' (No such file or directory)
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(, , ) VALUES ('Gigafun Compile Log', 'Dway', 'LOAD_FILE('ggf_compile.log')')' at line 1
Problém je na řádku 19 kde je tento sql script
echo "INSERT INTO `pastebin`.`pastes` (`title`, `name`, `raw`) VALUES ('Gigafun Compile Log', 'Dway', 'LOAD_FILE('ggf_compile.log')');" | mysql -u trinity --password=trinity pastebin
-
protoze tam mas naprosto nesmyslne ty `backticks` .. to potom opravdu nemuze byt moc gigafun .. myslel jsem si to uz na zacatku, ale neukazal jsi, co to pise .. dej tam 'jednoduche' uvozovky misto nich
-
echo "INSERT INTO 'pastebin'.'pastes' ('title', 'name', 'raw') VALUES ('Gigafun Compile Log', 'Dway', 'LOAD_FILE('ggf_compile.log')');" | mysql -u trinity --password=trinity pastebin
takto to taktéž nejde
output:
root@dway: [/home/wow/scr/comp]# bash ggf.sh
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''pastebin'.'pastes' ('title', 'name', 'raw') VALUES ('Gigafun Compile Log', 'Dwa' at line 1
root@dway: [/home/wow/scr/comp]#
/e: tak jsem se pokusil script trošku změnit, no vše funguje, až na to, že do sloupce 'raw' nelze zapsat obsah souboru ggf_compile.log
script:
#!/bin/bash
function compile()
{
cd /home/wow/srv/ggf
mkdir -p build
cd build
cmake /home/wow/srv/ggf/ -DPREFIX=/home/wow/srv/ggf/build/ -DLIBSDIR=/home/wow/libs/
make -j8
make install
}
function compile_to_file()
{
compile | tee ggf_compile.log
}
function compile_log_to_paste()
{
echo "INSERT INTO pastebin.pastes (title, name, raw) VALUES ('Gigafun_Compile_Log', 'Dway', 'LOAD_FILE('ggf_compile.log')'');" | mysql -u trinity --password=trinity pastebin
}
#compile_to_file
compile_log_to_paste
output:
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ggf_compile.log')'')' at line 1
-
priste rovnou uved o co se snazis .. v tom sql vyrazu mas podle me chybu v tech uvozovkach .. neda se vnorit 'jednoduchy' do jinych 'jednoduchych' .. tzn:
INSERT INTO pastebin.pastes (title, name, raw) VALUES ('Gigafun_Compile_Log', 'Dway', LOAD_FILE('ggf_compile.log'));