Sponsored Content
Full Discussion: [Bash] Beginner at scripting
Top Forums Shell Programming and Scripting [Bash] Beginner at scripting Post 302480392 by Chubler_XL on Tuesday 14th of December 2010 06:58:03 PM
Old 12-14-2010
Not quite sure what is going on here, but there is a lot of duplication of code and the following should be functionally equilivent, without the duplicated code.

It's quite normal to use the "[" construct instead of test and tends to make things a little more readable.

Code:
#!/bin/bash
 
url=$1
category=$2
 
wget $1
 
for ext in jpg jpeg png
do
    filename=$(ls *.$ext)
    if [ $? -eq 2 ]; then
        cp /var/www/blogger/scripts/$filename /var/www/blogger/gallery/_thumb/$category
        cp /var/www/blogger/scripts/$filename /var/www/blogger/gallery/$category
        mogrify -resize 160x140 /var/www/blogger/gallery/_thumb/"$category"/$filename
        rm /var/www/blogger/scripts/*.$ext
        break
    fi
done


Note if you dont wan't the error from ls to go to stderr you can redirect this to null like:

Code:
filename=$(ls *.$ext 2> /dev/null)

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Beginner bash scripting - a few problems

Hey Guys, I am creating a bash script on my freeBSD box, the script should basically ask the user to enter a username and domain. The script will take this information and basically append alot of information to config files so the user can receive email from that domain and create a web site at... (1 Reply)
Discussion started by: traxy
1 Replies

2. Homework & Coursework Questions

Beginner Scripting Issue

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: The object is to enter a number, then have another classmate guess the entered number. 2. Relevant commands,... (6 Replies)
Discussion started by: Jjohn1987
6 Replies

3. Shell Programming and Scripting

Need help for scripting beginner

hy guys, I have perl script provided to me but i need to convert it into shell .Can you help me in this using sed shell command. cat /etc/passwd |perl -ne '/^(\w+):\w+: (\w+)/ and print "$1, $2\n";' (1 Reply)
Discussion started by: singh_king
1 Replies

4. OS X (Apple)

scripting beginner

hi i have been given the task of sorting some scripting issues , i first of all need to decifer the ones that are being used is there anybody can do this for me :rolleyes: (4 Replies)
Discussion started by: aguiness
4 Replies

5. Shell Programming and Scripting

beginner scripting questions User variables

If there's anywhere to look this up, it would be just as helpful. I googled and really couldn't find anything relative to this. ok... General Variables 1) When creating a script I made a file "prog1.sh" does it matter if the end is .sh or is this what has to be done like prog.bash or... (4 Replies)
Discussion started by: austing5
4 Replies

6. Shell Programming and Scripting

Beginner Scripting for school

Hello people, I am new to the forum and to scripting and I'm honored to be a part of the Forum :) At the moment I'm learning to do basic scripting for school. Now I got 2 assignments that I do not understand. The case scripting I have mastered a bit. But now I have an assingment to make with... (1 Reply)
Discussion started by: hulsi88
1 Replies

7. Shell Programming and Scripting

Beginner - scripting help!

hi all, i am very new to linux and am trying to create a basic script. I would like the script to copy files from one directory into another, (e.g Script ~/my-documents/fileone ~/my-documents/filetwo) Once all files have been copied, i'd like another script to run automatically and rename... (12 Replies)
Discussion started by: highland
12 Replies

8. Shell Programming and Scripting

Beginner Bash Scripting Question

Hello, I am new to Linux and studying to become a Unix System Admin. I am taking a course in which I was practicing creating a bash script to ping a particular IP address. The script can be found below: #/bin/bash echo "Enter the IP address" read ip if then ping -c 1 $ip if ;... (3 Replies)
Discussion started by: shah9250
3 Replies

9. UNIX for Beginners Questions & Answers

Beginner at bash scripting - need help with passing arguments

I at the moment, making a simple bash script, capable of setting up an workspace for me, so i don't have to do it manually.. Problem is though i can't seem to provide the bash script any argument, without running into my error checks, checking for input... Here is the code: #!/bin/bash... (7 Replies)
Discussion started by: kidi
7 Replies
totem-video-thumbnailer(1)												totem-video-thumbnailer(1)

NAME
totem-video-thumbnailer - video thumbnailer for the GNOME desktop SYNOPSYS
totem-video-thumbnailer [-j|--jpeg] [-l|--no-limit] [-g num|--gallery num] [-s size] input output [backend options] DESCRIPTION
This manual page documents briefly the totem-video-thumbnailer command. This manual page was written for the Debian Project because the original program does not have a manual page. totem-video-thumbnailer is used internally by GNOME applications such as nautilus to generate PNG thumbnails of video files. While it is possible to invoke it manually, it is usually done automatically by nautilus. ARGUMENTS
input The input filename. This can be in any format that totem can play. output The output filename, output in PNG format. backend options Options to be passed to the backend (i.e. gstreamer). OPTIONS
-j --jpeg Switch the output format to JPEG. The default is PNG. -g num --gallery num Output a gallery of the given number (0 is the default) of screenshots. -l --no-limit Don't limit the thumbnailing time to 30 seconds. For debugging purposes. -s size The size of the thumbnail. Example: "64x64". The default is "128x96". AUTHOR
totem-video-thumbnailer was written by Bastien Nocera <hadess@hadess.net>. This manual page was written by Zack Cerza <zcerza@coe.neu.edu> for the Debian Project (but may be used by others). SEE ALSO
totem, nautilus GNOME
2009-05-06 totem-video-thumbnailer(1)
All times are GMT -4. The time now is 05:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy