|
2010-12-04
, 18:17
|
Posts: 486 |
Thanked: 251 times |
Joined on Oct 2009
|
#2
|
The following is a script I wrote but I have no clue on how to make it executable and how can i make an icon for it to launch a script. If someone would be kind to pass a few links, will be helpful for me.
chmod +x filename
Does Linux Scripts support GOTO and Labels? Also I had referred a few sites over google to come up with this.. Hope someone helps with corrections.
system "command options arguments";
`command options arguments`;
The Following 2 Users Say Thank You to j.s For This Useful Post: | ||
|
2010-12-04
, 19:03
|
|
Posts: 238 |
Thanked: 291 times |
Joined on Mar 2010
@ London, UK
|
#3
|
makes a file executable. The file system needs to be mounted with the exec option. The Mydocs partition is mounted noexec by default, so your script should be stored someplace else if it is on Mydocs.Code:chmod +x filename
For elaborate logic flow, you might want to consider perl or python. perl can invoke OS commands with
orCode:system "command options arguments";
Code:`command options arguments`;
|
2010-12-04
, 20:28
|
Posts: 136 |
Thanked: 150 times |
Joined on Dec 2010
@ Finland
|
#4
|
|
2010-12-05
, 10:24
|
|
Posts: 238 |
Thanked: 291 times |
Joined on Mar 2010
@ London, UK
|
#5
|
|
2010-12-05
, 11:22
|
|
Posts: 1,648 |
Thanked: 2,122 times |
Joined on Mar 2007
@ UNKLE's Never Never Land
|
#6
|
#!/bin/sh selection= until [ "$selection" = "0" ]; do echo "" echo "MENU" echo "1 - first command" echo "2 - second command" echo "3 - third command" echo "" echo "0 - exit program" echo "" echo -n "Enter selection: " read selection echo "" case $selection in 0) exit ;; 1) cd /home/user/;; 2) ls -al;; 3) ssh user@192.168.0.3;; *) echo "Please enter 1, 2, or 0" esac done
/usr/share/applications/hildon/myScript.desktop
[Desktop Entry] Encoding=UTF-8 Version=0.1 Type=Application Terminal=true Name=myScript Exec=/usr/bin/osso-xterm "/home/user/myscripts/myScript.sh" Icon=terminal X-Osso-Type=application/x-executable
The Following 2 Users Say Thank You to Saturn For This Useful Post: | ||
|
2010-12-05
, 18:30
|
|
Posts: 238 |
Thanked: 291 times |
Joined on Mar 2010
@ London, UK
|
#7
|
Hi fareed_xtreme,
Here some example code that might be useful to you.
To make a selection menu:
Code:#!/bin/sh selection= until [ "$selection" = "0" ]; do echo "" echo "MENU" echo "1 - first command" echo "2 - second command" echo "3 - third command" echo "" echo "0 - exit program" echo "" echo -n "Enter selection: " read selection echo "" case $selection in 0) exit ;; 1) cd /home/user/;; 2) ls -al;; 3) ssh user@192.168.0.3;; *) echo "Please enter 1, 2, or 0" esac done
The .desktop file should be put here:
and the contents should look like this:Code:/usr/share/applications/hildon/myScript.desktop
Good luck.Code:[Desktop Entry] Encoding=UTF-8 Version=0.1 Type=Application Terminal=true Name=myScript Exec=/usr/bin/osso-xterm "/home/user/myscripts/myScript.sh" Icon=terminal X-Osso-Type=application/x-executable
|
2010-12-07
, 07:42
|
|
Posts: 238 |
Thanked: 291 times |
Joined on Mar 2010
@ London, UK
|
#8
|
permission denied.
chmod +x Filename.sh
chmod 777 filename.sh
|
2010-12-07
, 08:10
|
|
Posts: 1,648 |
Thanked: 2,122 times |
Joined on Mar 2007
@ UNKLE's Never Never Land
|
#9
|
|
2010-12-07
, 13:33
|
|
Posts: 238 |
Thanked: 291 times |
Joined on Mar 2010
@ London, UK
|
#10
|
Maybe the permision denied comes from what you executed inside the script?
Can the commands you've put in the script be executed as user?
Use "ls -al" to view what priviledges you have set to a file.
Make a reboot and see if it is rmoved from the menu.
I am quite a noob when it comes to Linux. I used to write advanced scripts in Windows Powershell and now I want to do the same in Linux.
The following is a script I wrote but I have no clue on how to make it executable and how can i make an icon for it to launch a script. If someone would be kind to pass a few links, will be helpful for me.
I tried to run this in my N900 and it kinda screwed up the device as I am sure i did somethin wrong. had to reflash it. So would be really honoured if omeone could help a lil so tht I can do my contribution to this forum as well.
Last edited by fareed_xtreme; 2010-12-07 at 06:11.