Sponsored Content
Full Discussion: how to write shell prog
Top Forums Shell Programming and Scripting how to write shell prog Post 20288 by killerserv on Wednesday 24th of April 2002 03:39:49 AM
Old 04-24-2002
You may try it on C program. Here is a code that checks whther the string is palindrome or not in C.

Code:
main(c,v)
char**v;
{
	char*p;
	for(c>1?p=strchr(*++v,0):exit(1);*(*v)++==*--p&&*v<p||exit(puts(*v<p?"n":"y")-2) ; ) ;
}

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script prog help

How to write a program to store the list of ordinary files and the directory files in the specified directory in two files called dir.dat and ord.dat. Then print the largest directory and largest file? (1 Reply)
Discussion started by: rameshparsa
1 Replies

2. Programming

how to write a prog to check a no falls in febonacii series or not

hi, how to write a prog to check a no falls in febonacii series or not (2 Replies)
Discussion started by: useless79
2 Replies

3. Shell Programming and Scripting

how to call java prog from shell script

I have a java program to validate a XML file. I want to call this java program in a shell script which will be registered as concurrent program in oracle apps. Can anyone please let me know the step by step appraoch required to call java program in shell script like ....intial steps... (1 Reply)
Discussion started by: kcp_pavan
1 Replies

4. Shell Programming and Scripting

Need to Write Shell Script based off of this shell command

I'm trying to read a bunch of log files and output the lines that contain particular strings. To accomplish this, I've been running the following from the command line: find . -name "*" | xargs grep " " | grep " " > output.txt Two grep statements are needed in case I'm looking for a... (3 Replies)
Discussion started by: Rally_Point
3 Replies

5. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

6. Shell Programming and Scripting

How to write the shell using c

Hi, guys: I am working on my own shell using c. When I fork a child process and make it run in background. I hope when this process exits, my shell can print a line such as "this process exits". Does anyone know how to implement it? Thanks (5 Replies)
Discussion started by: tomlee
5 Replies

7. Shell Programming and Scripting

shell prog for double words

I need a shell programing script for "double words" Available Data: This is a shell script that is used to find the ten character words in the machine local dictionary (/usr/dict/words) that are made up with two valid english words that are five character long. This means that each of the... (0 Replies)
Discussion started by: sujithcrazy
0 Replies

8. UNIX for Dummies Questions & Answers

How to write Config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

9. Shell Programming and Scripting

How to write config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

10. Shell Programming and Scripting

Issues while trying to run a shell script using the command sh <filename.prog>

Hi, I'm facing issues while trying to run a sample program on Linux. If I try to run the script using the command "sh <filename.prog>", it doesn't work. But, if I try to execute it using the command "ksh <filename.prog>", it works fine. Even ". ./filename.prog" works fine. Can you... (6 Replies)
Discussion started by: venkatesh17
6 Replies
strchr(3)						     Library Functions Manual							 strchr(3)

NAME
index, rindex, strchr, strrchr - Search for character in string LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <strings.h> char *index( const char *s, int c); char *rindex( const char *s, int c); #include <string.h> char *strchr( const char *s, int c); char *strrchr( const char *s, int c); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: index(), rindex(): XPG4-UNIX strchr(), strrchr(): XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the string to search. Specifies a character, expressed as an int data type, to search for. DESCRIPTION
The index() function locates the first occurrence of the integer specified by the c parameter, which is converted to an unsigned char, in the string pointed to by the s parameter. The terminating null byte is treated as part of the string pointed to by the s parameter. The rindex() function locates the last occurrence of the integer specified by the c parameter, which is converted to a char value, in the string pointed to by the s parameter. The terminating null byte is treated as a part of the string pointed to by the s parameter. The strchr() and strrchr() functions provide the same functionality as the index() and rindex() functions, respectively. If c is a null byte ('') in any of these functions, the function locates the terminating null byte of s. RETURN VALUES
Upon successful completion, these functions return a pointer to the byte in the scanned string. When the byte specified by parameter c is not found, a null pointer is returned. RELATED INFORMATION
Functions: string(3), wcschr(3) Standards: standards(5) delim off strchr(3)
All times are GMT -4. The time now is 05:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy