![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Korn: How to loop through a string character by character | shew01 | Shell Programming and Scripting | 10 | 17 Hours Ago 04:58 AM |
| read a variable character by character, substitute characters with something else | vipervenom25 | UNIX for Dummies Questions & Answers | 2 | 06-06-2008 12:18 PM |
| replace a character with another character | satish@123 | Shell Programming and Scripting | 4 | 05-19-2008 02:57 AM |
| Can i read a file character by character | karnan | Shell Programming and Scripting | 6 | 05-18-2008 11:22 PM |
| Can I read a file character by character? | murtaza | Shell Programming and Scripting | 3 | 03-29-2007 08:19 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
how to get one character
I just need to know how to get one character in a string
i tried Code:
if [[ $# -eq 1 ]] && [[ cut -b54 $1 -ne 'X' ]] i am not sure if the cut command is a good way of doing this. i am still trying to figure it out. any help would be good cheers |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Almost there.... you need backticks
Code:
if [[ $# -eq 1 ]] && [[ `cut -b54 $1` -ne 'X' ]] ZB |
|
#3
|
|||
|
|||
|
cheers zazzybob, now it just seams to come up with the error
Code:
iip[44]: cut -b54 $1: bad number eh i not sure ksh for anyone that needs to know |
|
#4
|
||||
|
||||
|
Ahh... ksh - you'll need
`cut...` != 'X' Cheers ZB |
|
#5
|
|||
|
|||
|
cool that works, but my program doesnt
the $1 was a file name and all i wanted to know was if it existed or not. but that doest want to work either. but i did learn something and that otherwise works great, and it has put my closer to fix my problem cheers |
|||
| Google The UNIX and Linux Forums |