Arne Schmitz wrote:
> houghi schrieb:
>
>> Just wondering. The second (my) solution is already standard in .bashrc.
>> The first solution is not. How is the second solution easier then the
>> first. With the second, the only thing you have to do is add .alias in
>> your homedirectory.
>
> True. I thought he might want also do some other things that do only work
> with sourcing.
Sure. The only difference as far as I can see) is that the standard puts
a test in front of it. Not a bad idea. I did it in another script like:
OK=NOTOK
if [ -e "/etc/radiostreamrc" ]
then
. /etc/radiostreamrc
OK=OK
fi
if [ -e ~/.radiostreamrc ]
then
. ~/.radiostreamrc
OK=OK
fi
if [ "$OK" != "OK" ]
then
<snip making a file ~/.radiostreamrc>
What it does is first make /etc/radiostreamrc the default. Next it makes
~/.radiostreamrc the default, overwriting the first one. And if non of
these two are availbel, it makes a new one.
Later you can just edit ~/.radiostreamrc. No need to download two files.
It might be a bit complicated in scripting, but it works. The complete
source is here:
http://houghi.org/script/radiostream.sh and you need zenity installed as
well.
I also use `. ~/.passwords` in scripts. That way I put my passwords in
there, chmod it to 600 and I can still share scripts easily without
being afraid of sharing my passwords.
It looks like:
# Different passwords. Chmod to 600
IP_login=login1
IP_password=Password1
FTP_login=login2
FTP_password=Password2
In a script I then just use:
. ~/.passwords
echo $IP_login $IP_password
There probably are more secure ways to do this.
--
houghi http://houghi.org
>
All my postings should be read as if each line has a smiley behind it,
unless indicated otherwise, including the signature.
|
|