Sponsored Content
Full Discussion: display echo only once
Top Forums Shell Programming and Scripting display echo only once Post 302630415 by subway69 on Wednesday 25th of April 2012 08:04:26 PM
Old 04-25-2012
Quote:
Originally Posted by agama
Do you have it in a loop? Sounds to me like something other than the echo is your problem.

It would be helpful to see your script along with the shell that you are using and O/S.
sure thing it is a for loop

Code:
#!/bin/bash

for img in *.jpg
do
        if [ $# -gt 0 ]
then
        jpegtopnm "$img" | pnmscale -height 200 | pnmtojpeg > "${img%.jpg}-thumb.jpg"
        echo $img
else
        echo -n  "Please provide a proper image file"
fi
shift
done

what its doing is taking any file ending in .jpg in the current directory and making it into a thumbnail. I am running into a problem where I want it to display the error message only if no arguments are provided on the command line. I am not doing it right Smilie

Its my fault for trying to make it convert everything in the directory ending in .jpg using the FOR loop but I'm at the same time trying to feed an argument on the command line . . I am in a pickle... I would much rather just feed it command line but at the same time have it being able to take 1 argument or even a list but still give an error if no arguments are being displayed. Im new to this sorry. Any help is appreciated.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Display from a variable using echo.

I have a variable that is outputting a lot of space. here has been 45 lines returned ... how can I remove the spaces between the "been and the 45" CODE: fil_len=`wc -l < coshb.txt` if ; then cat coshb.txt | more echo " " echo "There has been ${fil_len} lines... (4 Replies)
Discussion started by: jagannatha
4 Replies

2. Shell Programming and Scripting

Echo display alignment/sort order

Hi, My script prints a few varibales as each it reads each line of a text file and then prints them on screen, however iam having problem in aligning and sorting them. what happens is this Last First Number Mark leo 87798798... (1 Reply)
Discussion started by: shackman66
1 Replies

3. Shell Programming and Scripting

what does echo $$ command display

whats the value stored in $$ (2 Replies)
Discussion started by: suri
2 Replies

4. Shell Programming and Scripting

Need a Command To display "echo command value in loop" in single line.

Hi I want to display "echo command value in loop" in single line. My requirement is to show the input file (test_1.txt) like the output file (test_2.txt) given below. Input file :test_1.txt a1|b1|4|5 a1|b1|42|9 a2|b2|32|25 a1|b1|2|5 a3|b3|4|8 a2|b2|14|6 Output file:test_2.txt... (2 Replies)
Discussion started by: sakthifire
2 Replies

5. UNIX for Dummies Questions & Answers

How to correctly use an echo inside an echo?

Bit of a weird one i suppose, i want to use an echo inside an echo... For example... i have a script that i want to use to take users input and create another script. Inside this script it creates it also needs to use echos... echo "echo "hello"" >$file echo "echo "goodbye"" >$file ... (3 Replies)
Discussion started by: mokachoka
3 Replies

6. Shell Programming and Scripting

Display echo results in three column

Dear Friends, I have my command output which displays on one row and values are now scrollable (vertical) 3 pages. How do i display those output in three column so that i no need to scroll? Example: dcadd$cat components 1.Caluculator 2.Diary ... ... 50.Mobile 51.Battery .. ...... (12 Replies)
Discussion started by: baluchen
12 Replies

7. Shell Programming and Scripting

echo display problem

Hi I am facing a strange problem a=03 echo ${a} the output is 3 But i want to display it is 03 Can you people help me how to display it like 03. Thanks (2 Replies)
Discussion started by: aishsimplesweet
2 Replies

8. Shell Programming and Scripting

Display and write in file in one echo command

Hi All, I want to display content on command promt and also write in file. For that iI ahve to write two sentence echo "XXXXXXX" echo "XXXXXXXX" >> 1.txt Is there any way to write in one echo statement (1 Reply)
Discussion started by: vivek1489
1 Replies

9. Homework & Coursework Questions

Using ls or echo to display a specific output

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: What single command line would you enter to get the following output? 8140 drwxr-xr-x 9 root bin 18 Jan 20... (6 Replies)
Discussion started by: dasboot
6 Replies
img-window(n)															     img-window(n)

NAME
img-window - Img, Tk Windows (window) SYNOPSIS
package require Tk package require img::window ?1.3? image create photo ?name? ?options? DESCRIPTION
The package img::window is a sub-package of Img. It can be loaded as a part of the complete Img support, via package require Img, or on its own, via package require img::window. Like all packages of Img it does not provide new commands, but extends the existing Tk command image. More specifically img::window extends Tk's photo image type. The name of the new format handler is window. This handler does not provide additional configuration options. This handler is special. Instead of reading or writing image data from a file or string it allows the embedding of a Tk widget into the photo image. In other words, it takes a snapshot of the contents of a Tk window. All of the above means that in a call like image create photo ?name? ?options? [1] Image data in window format (option -data) is detected automatically. Image data is considered to be in the window format if the value given to option -data is the name of an existing Tk window. Note that the standard option -file is not supported by this handler. [2] The format name window is recognized by the option -format. SEE ALSO
img-bmp, img-gif, img-ico, img-intro, img-jpeg, img-pcx, img-pixmap, img-png, img-ppm, img-ps, img-sgi, img-sun, img-tga, img-tiff, img- window, img-xbm, img-xpm KEYWORDS
image handling, tk, window COPYRIGHT
Copyright (c) 1995-2003 Jan Nijtmans <nijtmans@users.sourceforge.com> Img 1.3 img-window(n)
All times are GMT -4. The time now is 07:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy