Jump to content


Photo

Shell Scripts


  • Please log in to reply
6 replies to this topic

#1 Kramy

Kramy

    Mega GP Mania

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 622 posts

Posted 06 April 2008 - 04:55 AM

Edit: Figured it out.
CODE
find /mnt/sd/game/_Java -name jamvm -print >> dir.txt


Question 2: How do I store the result of 'find' in a variable?
Edit: Solved
CODE
MYVAR=`find /mnt/sd/game/_Java -name jamvm`


Question 3: How to I change the order dirs appear in the Games menu?

Edited by Kramy, 06 April 2008 - 08:55 AM.


#2 juanvvc

juanvvc

    GP32 Hardcore

  • GP32 Hardcore
  • PipPipPipPip
  • 291 posts
  • Gender:Male
  • Location:Catalonia
  • Interests:Robotics, P2P research, information security, privacy, little devices

Posted 06 April 2008 - 10:04 AM

To output the current dir, you have the 'pwd' command.

QUOTE
pwd >> dir.txt



#3 simonb

simonb

    GP32 Hardcore

  • Members
  • PipPipPipPip
  • 141 posts

Posted 06 April 2008 - 10:49 AM

QUOTE(Kramy @ Apr 6 2008, 05:55 AM) View Post


Question 3: How to I change the order dirs appear in the Games menu?


In what sense ? You could pipe the output thru `sort' for alpha, numerical, etc... or use `ls -t' to sort on date...

#4 Kramy

Kramy

    Mega GP Mania

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 622 posts

Posted 06 April 2008 - 08:02 PM

QUOTE(simonb @ Apr 6 2008, 03:49 AM) View Post

QUOTE(Kramy @ Apr 6 2008, 05:55 AM) View Post


Question 3: How to I change the order dirs appear in the Games menu?


In what sense ? You could pipe the output thru `sort' for alpha, numerical, etc... or use `ls -t' to sort on date...

Sorry - my Question 3 was mostly unrelated to Shell Scripts. I was just wondering because I hate scrolling through 30 items to find the right dir, so I can then test the shell script again. laugh.gif When I said the Games Menu, I mean the GP2X Games menu.


juanvvc: Thanks!

Edit: I'm messing with the Java launcher script, so I can place it anywhere on my SD card.

Anyway...can someone clarify the behaviour of this line?
CODE
LD_LIBRARY_PATH=$JAMVM/sdl:$JAMVM_CP/lib/classpath:$LD_LIBRARY_PATH

QUOTE
LD_LIBRARY_PATH=$JAMVM/sdl:$JAMVM_CP/lib/classpath:$LD_LIBRARY_PATH


Thanks!

Edited by Kramy, 06 April 2008 - 08:06 PM.


#5 juanvvc

juanvvc

    GP32 Hardcore

  • GP32 Hardcore
  • PipPipPipPip
  • 291 posts
  • Gender:Male
  • Location:Catalonia
  • Interests:Robotics, P2P research, information security, privacy, little devices

Posted 07 April 2008 - 07:51 AM

To prevent scrolling 30 items, a quick solution is naming your test directory AAA and it will be the first in the list. Besides, you can use GMenu2x and categorize games in your own way.

That particular line means "add these two directories to LD_LIBRARY PATH". If you write just: LD_LIBRARY_PATH=$JAMVM/sdl:$JAMVM_CP/lib/classpath, you will lose the original contents of LD_LIBRARY_PATH, if any. It is save to use that sentence even if LD_LIBRARY_PATH was originally empty.

By the way, LD_LIBRARY_PATH holds the directories to search for dynamic libraries (DLLs in Windows) Since you want to prioritize libraries in JAMVM over system libraries, you add the original LD_LIBRARY_PATH to the end of the new variable.

#6 Kramy

Kramy

    Mega GP Mania

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 622 posts

Posted 07 April 2008 - 10:02 AM

QUOTE(juanvvc @ Apr 7 2008, 12:51 AM) View Post

To prevent scrolling 30 items, a quick solution is naming your test directory AAA and it will be the first in the list. Besides, you can use GMenu2x and categorize games in your own way.

That particular line means "add these two directories to LD_LIBRARY PATH". If you write just: LD_LIBRARY_PATH=$JAMVM/sdl:$JAMVM_CP/lib/classpath, you will lose the original contents of LD_LIBRARY_PATH, if any. It is save to use that sentence even if LD_LIBRARY_PATH was originally empty.

By the way, LD_LIBRARY_PATH holds the directories to search for dynamic libraries (DLLs in Windows) Since you want to prioritize libraries in JAMVM over system libraries, you add the original LD_LIBRARY_PATH to the end of the new variable.

Thank you very much. It makes sense now. biggrin.gif

I dumped the contents of the var; it was really, really long. It's safe to say it doesn't get cleared; it just keeps adding on to the front. ohmy.gif

Anyway, my new java launcher script appears to work from any dir; I successfully ran a jar file that wrote some text to a text file on my F200. biggrin.gif It also avoids that annoying second java launcher; just goes right into the app!

Oh, and it restores the LD_LIBRARY_PATH var on exit. laugh.gif

Once I clean up some stuff, and determine if I messed anything up, I'll post it. More testing tomorrow!

#7 Kramy

Kramy

    Mega GP Mania

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 622 posts

Posted 09 April 2008 - 09:01 AM

Hehe...getting SDL to work properly when JamVM it isn't in the correct path is a pain. I think it might have to be recompiled. Oh well.