![]() |
A equivilent of a .bat file on the n900?
I'm a bit of a linux noob so bear with me.
Basically i wonder if theres a way i can store two commands for x terminal and store them in a file which i could just open and it would execute the commands for me, like how .bat files do with command prompt in windows. This would make my life much easier as i can't find a way to copy and paste in x terminal. sudo gainroot; echo 118 > /sys/class/i2c-adapter/i2c-2/2-0063/power_level; This is what i'd like to do, a solution like this would save me lots of tedious typing every car journey |
Re: A equivilent of a .bat file on the n900
Code:
echo "#!/bin/bash" > powerlevel.sh |
Re: A equivilent of a .bat file on the n900
Pretty good, 2 small things:
-there is no bash in the default install, and i'm not sure if the symlink exists, so please change the first line to "#!/bin/sh" -you forgot to mention, that the script can be run by issuing the following command from the x terminal: ./powerlevel.sh |
Re: A equivilent of a .bat file on the n900
thanks guys for your quick replies. this looks like what i would need, so just to check, do i type the code as crashanddue posted in x terminal and it will create the file, and then to run i just need to type ./powerlevel.sh as zio said?
|
Re: A equivilent of a .bat file on the n900
Yes, you type in this in X Terminal:
Code:
echo "#!/bin/sh" > powerlevel.sh Code:
./powerlevel.sh |
Re: A equivilent of a .bat file on the n900
Code:
#!/bin/sh |
Re: A equivilent of a .bat file on the n900
I think i have this problem, i have write the script as written above amd made the change zoi said, it works fine when i run it when i'm already root in xterm however it doesn't change the powerlevel if i run it as user, even though the sudo root command is in there, all it does is give me root access.
Any ideas what i need to change? |
Re: A equivilent of a .bat file on the n900
Quote:
|
Re: A equivilent of a .bat file on the n900
is the problem that it should be entered as one line? My browser splits the part after the pipe onto a new line.
|
Re: A equivilent of a .bat file on the n900
Quote:
One thing you *might* try is to setuid the script (chown file to root, and then chmod u+s the file) that does the things you want to do. You would then execute it as "user" but it would automagically run as root. Can provide a nice huge security hole in most unix systems, but with the "sudo gainroot" thing that doesn't even require a password, I'm not sure that's a concern in this particular case. |
All times are GMT. The time now is 10:33. |
vBulletin® Version 3.8.8