03-08-2013
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
how to do that ? I mean only print it but not execute. I'm using putty to interact with ksh.
(in windows cmd up arrow does the job)
thanks
vilius (5 Replies)
Discussion started by: vilius
5 Replies
2. Shell Programming and Scripting
Hello,
I have the following report (report.txt) file (see attached).
I would like to check the file and if the field is error, then showing error message at output.
1. In the report, 1st, 2st and 3nd line can be ignore to check
2. start to check line 4 (each field use "," to split
- 1st... (1 Reply)
Discussion started by: happyv
1 Replies
3. UNIX for Dummies Questions & Answers
Hi All,
I am new to unix scripting, please help me in completing this exercise,
I have a scenario as follows,
1. i have a text file(snapshot.txt) consisting of directory names, and file
size separated by comma as shown below:
snapshot.txt data:
... (1 Reply)
Discussion started by: G.K.K
1 Replies
4. Shell Programming and Scripting
I am trying to write a shell script that will allow the typing of a value, then using that value to replace data in a text file.
I suspect I need sed.
The format of the file is:
Variable1:Value1
Variable2:Value2
The interaction would be something like:
Shell Prompt: "Please enter the... (9 Replies)
Discussion started by: cleanden
9 Replies
5. Solaris
I have a netscape 4.79 browser for our GUI which connects to a Solaris5.8 box. During peek hours, we see question marks appearing in the screen instead of the text we enter. This results in query failure. This problem does not happen always, and is quite irritating because, we have to close the... (6 Replies)
Discussion started by: vanz
6 Replies
6. Shell Programming and Scripting
ok the user can only enter a number if a letter is entered it shouldnt be accepted
This is what i have so far
read -p "How many cars to enter:" cars
until
do
read -p "Invalid number. Please re-enter:" $tags
done (5 Replies)
Discussion started by: gangsta
5 Replies
7. Shell Programming and Scripting
Hello
Does the unix korn shell provide a function to convert number entered in command line argument to text or Character so that in next step i will convert Chr to Hex (6 Replies)
Discussion started by: aadityapatel198
6 Replies
8. Shell Programming and Scripting
Hi Experts,
path=/db/files/
format=$1
User can enter any file format.compare the user file format with actual file format existed in the directory /db/files. User enter all characters as "A" apart from date format.
example1: user will be entering the file format AAA_AA_YYYYMMDD.AAA
Actual... (6 Replies)
Discussion started by: nalu
6 Replies
9. Shell Programming and Scripting
Hello,
I'm looking to check only the first line of a file to see if it is a format string, like
# -*- coding: utf-8; mode: tcl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -\*- vim:fenc=utf-8:ft=tcl:et:sw=2:ts=2:sts=2if the first line is anything else, insert the above string.
I'd... (3 Replies)
Discussion started by: f77hack
3 Replies
10. Shell Programming and Scripting
hi all,
trying this using shell/bash with sed/awk/grep
I have two files, one containing one column, the other containing multiple columns (comma delimited).
file1.txt
abc12345
def12345
ghi54321
...
file2.txt
abc1,text1,texta
abc,text2,textb
def123,text3,textc
gh,text4,textd... (6 Replies)
Discussion started by: shogun1970
6 Replies
STRCMP(P) POSIX Programmer's Manual STRCMP(P)
NAME
strcmp - compare two strings
SYNOPSIS
#include <string.h>
int strcmp(const char *s1, const char *s2);
DESCRIPTION
The strcmp() function shall compare the string pointed to by s1 to the string pointed to by s2.
The sign of a non-zero return value shall be determined by the sign of the difference between the values of the first pair of bytes (both
interpreted as type unsigned char) that differ in the strings being compared.
RETURN VALUE
Upon completion, strcmp() shall return an integer greater than, equal to, or less than 0, if the string pointed to by s1 is greater than,
equal to, or less than the string pointed to by s2, respectively.
ERRORS
No errors are defined.
The following sections are informative.
EXAMPLES
Checking a Password Entry
The following example compares the information read from standard input to the value of the name of the user entry. If the strcmp() func-
tion returns 0 (indicating a match), a further check will be made to see if the user entered the proper old password. The crypt() function
shall encrypt the old password entered by the user, using the value of the encrypted password in the passwd structure as the salt. If this
value matches the value of the encrypted passwd in the structure, the entered password oldpasswd is the correct user's password. Finally,
the program encrypts the new password so that it can store the information in the passwd structure.
#include <string.h>
#include <unistd.h>
#include <stdio.h>
...
int valid_change;
struct passwd *p;
char user[100];
char oldpasswd[100];
char newpasswd[100];
char savepasswd[100];
...
if (strcmp(p->pw_name, user) == 0) {
if (strcmp(p->pw_passwd, crypt(oldpasswd, p->pw_passwd)) == 0) {
strcpy(savepasswd, crypt(newpasswd, user));
p->pw_passwd = savepasswd;
valid_change = 1;
}
else {
fprintf(stderr, "Old password is not valid
");
}
}
...
APPLICATION USAGE
None.
RATIONALE
None.
FUTURE DIRECTIONS
None.
SEE ALSO
strncmp() , the Base Definitions volume of IEEE Std 1003.1-2001, <string.h>
COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol-
ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE
and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained
online at http://www.opengroup.org/unix/online.html .
IEEE
/The Open Group 2003 STRCMP(P)