Sponsored Content
Top Forums Shell Programming and Scripting Can someone verify the code of two function Post 302564892 by rohit22hamirpur on Saturday 15th of October 2011 08:20:34 AM
Old 10-15-2011
Can someone verify the code of two function

Code:
Input=D123,S1234,D345 | kESTREL PRODUCTION SUPPORT

echo -en "Enter the logmsg="
read logmsg
logmsg1=${logmsg%%|*};
echo "$logmsg1"|tr ',' '\n' | sed 's/[ \t]*$ | sed '/^$/d'//'>pre-commit.config

Char()
{
while read line
do
if [[ ${line:0:1 = D ]] || [[ ${line:0:1 = S ]];then
echo "Success"
else
exit 1;
done<pre-commit.config
}

length()
{
while read LINE
do
len=`expr length "$LINE"`
if [ "$LINE" -le "6" ];then
echo "Success"
else
exit 2;
# and using the variable len for some purpose
done < pre-commit.config
}

length
Char


In the above script I want the two things

1) Each variable in the left of pipe should start with D and S
2) Each variable is of 6 characters
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PHP function kills my code?

So I'm making a page for one of my web sites that scans the visitors ports (just a few specific ones, not ALL) and tells them if they have any open. Now I made up the code and it worked great. Now instead of having the same chunk of code all over my script, I tried to make my own subroutine so I... (10 Replies)
Discussion started by: l008com
10 Replies

2. Shell Programming and Scripting

Please verify the simple Shell code

Hi, i am trying to write script which will delete files(more than 90 days older) from different directories. Please check its ok if i implement it in SUN solaris10; One important thing i used here "exec" flag. I heard from someone- as i have lots of files "exec" flag may give error like too... (2 Replies)
Discussion started by: thepurple
2 Replies

3. Programming

how to write a wrapper c code to return uid using getuid() function

And how to use setuid() ? thanks (4 Replies)
Discussion started by: pwd
4 Replies

4. Shell Programming and Scripting

My menu function [new code -revised]

Below is my menu options code. It allows user to pick one of two option. I can get the first option to work, because if it is selected it just "breaks" and carries on with the script. What i want to know is if a user selects option two how do i get that option to ignore all the other script and... (3 Replies)
Discussion started by: amatuer_lee_3
3 Replies

5. Shell Programming and Scripting

Verify large file with Unix function

I am seeking help on one UNIX function writting. Please help. I have a large file, named 'MyFile', It was tab-delmited. I am told that each line in 'MyFile' has 7 columns, and that the values in the 5th column are integers. How do I use shell functions (and standard LINUX/UNIX filters) to verify... (1 Reply)
Discussion started by: duke0001
1 Replies

6. UNIX for Dummies Questions & Answers

Verify the data type in a file with UNIX function

I am seeking help on this UNIX function, please help. Thanks in advance. I have a large file, named as 'MyFile'. It was tab-delmited, I am told that each record in column 1 is unique. How would I verify this with UNIX function or command? (1 Reply)
Discussion started by: duke0001
1 Replies

7. UNIX for Dummies Questions & Answers

Verify a flat file with UNIX function or script.

I re-post my question to seek your help and critique. I was required to verify a very large and tab-delimited file, named 'MyFile'. 1. The each line in 'MyFile' has 7 columns, and that the values in the 5th column are integers. I need to use shell functions (and standard LINUX/UNIX filters) to... (1 Reply)
Discussion started by: duke0001
1 Replies

8. Shell Programming and Scripting

Error using function in AWK code

Hi to all, I have an AWK code that looks like this: awk 'NR==FNR { #code to process file1 next } { #code to process file2 a=myfunction(x) } END { #Some code b=myfunction(x) ... (3 Replies)
Discussion started by: Ophiuchus
3 Replies

9. Homework & Coursework Questions

I need help movingworking code into library function and calling it obj13-2.pl

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! I need help moving working code into library function called obj13-lib.pl and call the same function in obj13-2.pl I am a Linux newbie and this certificate is my first step... (0 Replies)
Discussion started by: cllinuxhelp
0 Replies

10. Shell Programming and Scripting

Returning an exit code from a bash function

How to return a exit code from a function and use it in conditional? I tried the following but it does not seem to work. tests.sh: if test ./load.sh ; then echo "0" else echo "1" fi load.sh: return 1; from command line: $ ./tests.sh 0 I was expecting it to output "1"... (17 Replies)
Discussion started by: wolfv
17 Replies
XmScrollVisible(library call)											     XmScrollVisible(library call)

NAME
XmScrollVisible -- A ScrolledWindow function that makes an invisible descendant of a ScrolledWindow work area visible SYNOPSIS
#include <Xm/ScrolledW.h> void XmScrollVisible( Widget scrollw_widget, Widget widget, Dimension left_right_margin, Dimension top_bottom_margin); DESCRIPTION
XmScrollVisible makes an obscured or partially obscured widget or gadget descendant of a ScrolledWindow work area visible. The function re- positions the work area and sets the specified margins between the widget and the nearest viewport boundary. The widget's location relative to the viewport determines whether one or both of the margins must be adjusted. This function requires that the XmNscrollingPolicy of the ScrolledWindow widget be set to XmAUTOMATIC. scrollw_widget Specifies the ID of the ScrolledWindow widget whose work area window contains an obscured descendant. widget Specifies the ID of the widget to be made visible. left_right_margin Specifies the margin to establish between the left or right edge of the widget and the associated edge of the viewport. This margin is established only if the widget must be moved horizontally to make it visible. top_bottom_margin Specifies the margin to establish between the top or bottom edge of the widget and the associated edge of the viewport. This margin is established only if the widget must be moved vertically to make it visible. For a complete definition of ScrolledWindow and its associated resources, see XmScrolledWindow(3) RELATED
XmScrolledWindow(3). XmScrollVisible(library call)
All times are GMT -4. The time now is 12:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy