I'm able to execute bash script on server side linux via getJSON method
$.getJSON("settings/test_test.sh", function( data ) {
var items = [];
$.each( data, function( key, val ) {
if(key=="retval"){
if(val=="ok"){
return;
} else {
return;
}
}
});
console.log("Command Video: Error execuite script.");
return;
});
But i want to type an argument to it! I found some problems when i tried to implement this. Is there any possibilities to decide this problem? My bash script:
#!/bin/sh
case "$1" in
"1")
sed -i -e 's/abc/xyz/g' /var/www-utils/file.txt
;;
"2" | "3")
sed -i -e 's/xyz/abc/g' /var/www-utils/file.txt
;;
*)
sed -i -e 's/abc/acb/g' /var/www-utils/file.txt
;;
esac
[
{
echo '"retval": "ok"'
}
]
Everything works as expected when I execute script on server-machine. But if I'm trying to do same problem is GET http://192.168.10.1/settings/test_test.sh%201 404 (Not Found)
Aucun commentaire:
Enregistrer un commentaire