LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-08-2003, 03:06 AM   #1
micxz
Senior Member
 
Registered: Sep 2002
Location: CA
Distribution: openSuSE, Cent OS, Slackware
Posts: 1,131

Rep: Reputation: 75
grab - Simply a useless bash script to take a screen shot; Required command: import


It's my first bash script and felt I should share to someone, since my girlfriend does not seem to care at all about it. It's a usesless /bin/sh script to take a screen shot of your desktop and put the *.jpg in your home directory named grab-year,month & nanosecond. It supports the full screen or manually via drawing a box with your mouse. I only wrote this script to take screens faster, useless otherwise.

Create a file called "grab" insert this code into it:

Code:
#!/bin/sh
# grab
# description:
# A simple program to take a quick screen shot
#
# Required: import (Part of the image magic library)
#
# By Micxz

mygrab=`which import | tr -d ''`

if [ $mygrab == '' ] ; then
echo ""
echo "I'm Sorry I can't find: /usr/bin/import "
echo "Open this script and change \$mygrab at the top."
echo ""
exit 0
fi

case "$1" in

-f)
   echo ""
   RANDTIME=`/bin/date +%Y%m%N | tr -d ' '`
   $mygrab -window root ~/grab-$RANDTIME.jpg
   echo "Full grab done. Look in ~/"
   echo ""
   ;;


-m)
   echo ""
   RANDTIME=`/bin/date +%Y%m%N | tr -d ' '`
   $mygrab ~/grab-manual-$RANDTIME.jpg
   echo "Manual grab done. Look in ~/"
   echo ""
   ;;


*)

   echo ""
   echo "  USAGE:  grab [command] "
   echo ""
   echo "  COMMANDS:"
   echo "         -f       Grab the entire X server screen."
   echo "         -m       Manually grab the screen with your mouse."
   echo "         -help    Displays this list of options."
   echo ""
   exit 1 ;;

esac
exit 0
chmod 755 grab

Done;

Last edited by micxz; 07-11-2009 at 03:42 PM. Reason: removed hostname
 
Old 10-08-2003, 05:18 PM   #2
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
Your script deleted all my mp3s... Just kidding,

Although its task is small, this is a very clean, professional script.
Nice work.

Last edited by jinksys; 10-08-2003 at 05:22 PM.
 
Old 10-08-2003, 07:59 PM   #3
micxz
Senior Member
 
Registered: Sep 2002
Location: CA
Distribution: openSuSE, Cent OS, Slackware
Posts: 1,131

Original Poster
Rep: Reputation: 75
Thanks' I'm proud of it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash Script; command not found twintornado Programming 2 06-01-2005 09:59 AM
Import sys ?bash: import: command not found joirnange Linux - Newbie 4 12-28-2004 10:33 PM
Bash script - repeated command satimis Programming 27 10-28-2004 05:02 AM
How to start a Tcl/Tk script by simply invoking the script file itself ? cyu021 Programming 2 10-10-2004 11:00 AM
Simple Bash Script Help Command kemplej Linux - Software 1 03-11-2004 03:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration