Yeah great! i just add |cut -f2 -d '=' to that and it gets me what I want.
Does -z do like -v except it eliminates all FIELDS that don't match, or ?? |
-z is for testing empty strings.................in this case, the test is for NOT an empty string [ ! -z ... ], and by using the 'for' statement, it breaks up the input from the 'cat' command whenever 'for' parses any whitespace (blank spaces, tabs) or newlines, thereby letting you test each space-delimited field separately.......... :)
|
Re: *** chngcd ***
Quote:
/usr/local/bin/cdrom: ### beginning ### case "$1" in 'mount') sudo /sbin/mount /mnt/cdrom/ ;; 'umount') sudo /sbin/umount /mnt/cdrom/ ;; *) echo "Usage $0 mount|umount" ;; esac ### end ### And following in my /etc/sudoers ##begin## ivanatora ALL=NOPASSWD: /sbin/mount /mnt/cdrom/,/sbin/umount /mnt/cdrom/ ##end## Of course 'ivanatora' is my username, so if you want this to work you should change this. It can be easily modified to eject the cdrom, but I can't see the point. |
Re: Re: *** chngcd ***
Quote:
|
If anyone is having problems, there are two ways to overcome it....................either add the user to the same group as the block device ("disk" for Slackware), or change the permissions on the block device to make it readable for "others", ie., brw-r--r--
If you add the user to the same group as the block device for the CDROM, you might have to logout completely or reboot the machine............... :) |
thanks guys, those are really useful scripts.
|
Is there a page anywhere out there archiving all the useful bash scripts???
--Akshun J |
Quote:
Shell scripts on the web :) |
Nice. That will get my feet wet. Teaches me to come in at the end of a thread...
--Akshun J |
Here is a useful, if totally simplistic script, that is handy to see what Slackware packages in a given directory are *not* installed. For instance, I keep a local mirror of Slackware-current and I want to know if there are any packages in my slackware-current/slackware/gnome directory that are not already installed. I put a copy of this script in /usr/local/bin and change to /home/ftp/pub/slackware-current/slackware/gnome and run packcheck.sh. If anybody wants to improve on this, post your improvements here.
-------------------- #!/bin/sh for pack in $(ls *.tgz); do pack=$(basename $pack .tgz) if [ ! -f /var/log/packages/$pack ]; then echo "No Package $pack found" fi done ------------------ Chuck |
*** whichpkg UPDATE ***
NOTE: This update is superseded by the changes posted here..... :)
|
moving my post
|
I just wanted to say a big THANKS to you geekster! I've been using your scripts a bit and find them very useful :)
|
*** FINAL UPDATES for lspkg, whichpkg, and pkginfo ***
Okay, I think I've gone about as far as I can with these three scripts, lspkg, whichpkg, and pkginfo................They are all converted over from using regular expression syntax to wildcard matching (globbing). While not true globbing, they are close enough for practical purposes here...........If you're interested knowing what the difference is, read the manpages for globbing and regular expressions, 'man 7 glob' and 'man 7 regexp'. (Note - For KDE users, you can view the manpages in a html format by entering these urls in Konqueror, 'man:/glob(7)' and 'man:/regexp(7)'. This only works in Konqueror, not any other browser in KDE.).......Be sure to include the number 7 in both............
I did a major overhaul for the whichpkg script, making it easier to read the output, filtering out more of the unwanted garbage, and allowing for multiple search terms. It ended up being a bit of a challenge, more than I had anticipated....... :)..........but I think I've got it right (it sure did sharpen my regexp skills.......LOL).............A few search terms were quite unpredictable, most notably the searches for "ln", "file", "install" and "sh"...........If there are others you come across which seem not quite right, be sure to post them here and I'll fix it. otherwise this is pretty much the final update. The other two were mostly to convert to using wildcard searching (pkginfo) or a minor change in the usage of the wildcards in the search term (lspkg)..........Again, I don't see where they can go much farther, so these will also be the final updates. HOWEVER................I'm going to create another Slackware specific script to deal with orphaned files by looking at all the system files and matching them against the list of files found in the /var/log/packages/ and /var/log/scripts/ directories..............Then you will be presented with a report of all the files that aren't accounted for from the installed packages..............Some of these may be from various scripts and files you may have added manually, such as these scripts, but some may be leftovers from old installations no longer around.................Either way, you will have a list to look over and decide for yourself whether they belong there or not..............The reason for this script is from some of the posts I've seen recently asking about what files are safe to remove, or a way to determine which files are not wanted or needed...........I do love a challenge............. :D Okay, enought talk, the changes have already been made in the top post (post #1) above.... EDIT: Changed line number 53 in "pkginfo" script by removing the path "/var/log/packages/" (The third line from the end, above the two "esac" lines). Thanks goes to carboncopy for pointing out this error. :) EDIT2: More changes needed in the "pkginfo" script as noted below. |
Hi! I tested out all three new one but pkginfo seems to be not working properly for me. This is what happens:
Code:
bash-2.05b# ./pkginfo gnome |
All times are GMT -5. The time now is 06:48 AM. |