Need help with script to add entry to my library path

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
lovabill

Need help with script to add entry to my library path

Post by lovabill »

Anyone expert here? I have a silly script question as well.

I wrote this line in setlibpath.sh file:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
When I execute
sh ./setlibpath.sh
and then testing it with
echo $LD_LIBRARY_PATH
it doesnt work.

But when I simply run the line in console, it does! Why?
All I want to do, is put the script in the Mint autostart list.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
xenopeek
Level 25
Level 25
Posts: 29460
Joined: Wed Jul 06, 2011 3:58 am

Re: Need help with script to add entry to my library path

Post by xenopeek »

Split from http://forums.linuxmint.com/viewtopic.php?f=90&t=91155 and moved here. See the forum rules; new questions deserve new topics and don't reply to support requests older than six months. Thanks :)

You probably want your setlibpath.sh file to read:

Code: Select all

#!/bin/sh
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
Without that first line it is not a script, and won't be executed. Also make sure you have marked the file to be executable. You can do so with your file manager, or with:

Code: Select all

chmod +x setlibpath.sh
But there is probably a better place to set your LD_LIBRARY_PATH... (Gentle clue for more knowledgeable users to pitch in :))
Image
Locked

Return to “Scripts & Bash”