Sponsored Content
Top Forums Shell Programming and Scripting few small scripting questions Post 302089527 by bebop1111116 on Tuesday 19th of September 2006 02:58:41 PM
Old 09-19-2006
few small scripting questions

hello everyone, i have a couple of questions about programming with shell scripts.

-My question is, how do you find out how long a sequence of numbers that has just been entered is. for example

If i enter 12345 the length here is 5
and 23456789 the length here is eight.

I want to be able to do an if statment that says if the string of numbers are a certain length do somthing, else do somthing.

-My last question, how do you tell your program that if you have a number, and you divide it by another number to do one thing if it divides evenly and something else if it is not? for example

lets say i have a while statement, and i want to say while the number i have is not evenly divisiable then display a message, but as soon as it can be evenly divided display a different message. And i do have a way of changing the number i am dividing by each time.

Thanks

Last edited by bebop1111116; 09-19-2006 at 04:53 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

questions on ftp shell scripting

did a search but was not allowed to use 'ftp' because its too short of a word. for some reason, i can't seem to remember anything about ftp shell scripts - would someone please refresh my memory on the syntax and maybe give a short example? thanks for the time. (5 Replies)
Discussion started by: psyjoniz
5 Replies

2. Shell Programming and Scripting

Shell/commands/scripting/c questions

1. Can anyone explain me what the line x=signal(SIGINT,nh); does? 2. How do I write a command to print the longest line in a file? 3. How do I write a command to print the last word of every line of a file using sed? 4. What exactly does this line do? :%s/^\(\)\(\)/\2\1/g^M... (3 Replies)
Discussion started by: Necrologist
3 Replies

3. Shell Programming and Scripting

Need small help

Hi, i have a client requirement to post the files into generic folder named as "source".file identification is to retrieve Publication code (Instance name) from the file name.So thereafter we move the files to different instances of specific folders for the same unix server.(means if the file... (2 Replies)
Discussion started by: kirankumar
2 Replies

4. Shell Programming and Scripting

Shell scripting questions

I have a file like this. Pls help me to solve this. 08-24-2010 10:22:34,xxxxxxxxMessage : 111 08-24-2010 10:24:38,xxxxxxxbMessage : 000 08-24-2010 11:28:11,xxxxxxxcMessage : 111 08-24-2010 11:32:35,xxxxxxxdMessage : 111 08-24-2010 11:32:35,xxxxxxxeMessage : 111 (I should look for Message... (1 Reply)
Discussion started by: mnjx
1 Replies

5. Shell Programming and Scripting

Small help in scripting !!!

Hi all, I have a script in which line like this .. linux_ver="RHEL$(cat /etc/redhat-release | awk '{print $7}')" Result is linux_ver=RHEL5.3 But i want the o/p to be linux_ver=RHEL5 (discard ".3" or what ever comming after 5) please help me out Thanks in advance Renjesh... (4 Replies)
Discussion started by: Renjesh
4 Replies

6. Homework & Coursework Questions

Print questions from a questions folder in a sequential order

1.) I am to write scripts that will be phasetest folder in the home directory. 2.) The folder should have a set-up,phase and display files I have written a small script which i used to check for the existing users and their password. What I need help with: I have a set of questions in a... (19 Replies)
Discussion started by: moraks007
19 Replies

7. Homework & Coursework Questions

Scripting questions

I have two scripts and wish to finish the labs in two days, I am not sure how to make these work though. Any help would be appreciated, a step by step guide would be great! Q1) Complete the following instructions and submit the questions and answers from this lab to your tutor. Please... (1 Reply)
Discussion started by: noobie123
1 Replies

8. Shell Programming and Scripting

need a small help

Hi, sorry for inconvenience..wrong query posted. Thanks for your help. Thanks (1 Reply)
Discussion started by: kirankumar
1 Replies

9. 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

10. Shell Programming and Scripting

Scripting questions, remote access

Hi, Background: There are 2 servers server1 and server2 In server1 i have my script to perform a functionality from the script in server1 i m calling a script named action in server2. The script action has to check the size of a file in a particular location in server1, if the size of the file... (1 Reply)
Discussion started by: jayii
1 Replies
ppmdist(1)						      General Commands Manual							ppmdist(1)

NAME
ppmdist - simplistic grayscale assignment for machine generated, color images SYNOPSIS
ppmdist [-intensity|-frequency] [ppmfile] DESCRIPTION
Reads a portable pixmap as input, performs a simplistic grayscale assignment intended for use with grayscale or bitmap printers. Often conversion from ppm to pgm will yield an image with contrast too low for good printer output. The program maximizes contrast between the gray levels output. A ppm input of n colors is read, and a pgm of n gray levels is written. The gray levels take on the values 0..n-1, while maxval takes on n-1. The mapping from color to stepped grayscale can be performed in order of input pixel intensity, or input pixel frequency (number of repeti- tions). OPTIONS
-frequency Sort input colors by the number of times a color appears in the input, before mapping to evenly distributed graylevels of output. -intensity Sort input colors by their grayscale intensity, before mapping to evenly distributed graylevels of out- put. This is the default. BUGS
Helpful only for images with a very small number of colors. Perhaps should have been an option to ppmtopgm(1). SEE ALSO
ppmtopgm(1), ppmhist(1), ppm(5) AUTHOR
Copyright (C) 1993 by Dan Stromberg. 22 July 1992 ppmdist(1)
All times are GMT -4. The time now is 02:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy