You are not logged in.
Hey all,
Arch newbie here. Can't believe I didn't switch to Arch sooner. I wrote a small script to wget Bing's picture of the day and set it as a wallpaper with feh.
Blog post is here
http://www.loganmarchione.com/?p=1767
GitHub is here
https://github.com/loganmarchione/wallscript
Any recommendations to improve would be greatly appreciated!
Offline
Welcome to Arch.
Moving this thread to community contributions
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Welcome to Arch.
Moving this thread to community contributions
Thanks! I had a feeling it was in the wrong place.
Offline
Any recommendations to improve would be greatly appreciated!
Just an idea but you have the wallpaper directory defined as follows
directory=~/wallpapers/bing/
You could do something like:
directory="${1:-~/wallpapers/bing/}"
This mean that the directory would be ~/wallpapers/bing unless someone specified a different directory at the command line. This is easier to explain with an example:
$ cat wp.sh
#!/bin/bash
directory="${1:-~/wallpapers/bing/}"
echo $directory
$ ./wp.sh
~/wallpapers/bing/
$ ./wp.sh /i/want/my/own/dir
/i/want/my/own/dir
If you want to do something like this, you should probably enclose the dir in quotes (to allow for spaces etc) and add the -p flag to mkdir
Last edited by oliver (2014-12-08 19:14:47)
Offline
lmm5247 wrote:Any recommendations to improve would be greatly appreciated!
Just an idea but you have the wallpaper directory defined as follows
directory=~/wallpapers/bing/
You could do something like:
directory="${1:-~/wallpapers/bing/}"
This mean that the directory would be ~/wallpapers/bing unless someone specified a different directory at the command line. This is easier to explain with an example:
$ cat wp.sh #!/bin/bash directory="${1:-~/wallpapers/bing/}" echo $directory
$ ./wp.sh ~/wallpapers/bing/ $ ./wp.sh /i/want/my/own/dir /i/want/my/own/dir
If you want to do something like this, you should probably enclose the dir in quotes (to allow for spaces etc) and add the -p flag to mkdir
Thanks! I didn't know you could do that!
Offline
Thanks! I didn't know you could do that!
It may be overkill for what you plan (since you're probably editing the script for other stuff anyway) but it's definitely a nice thing to know. I *think* it's bash 4.x only BTW (but I'm usually wrong)
Offline
FWIW, that parameter expansion worked in bash 3.2.39.
But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner
Offline