Results 1 to 2 of 2
hello friends,,
my problem is about ispell
when i enter three argument to a script which is coded.
if the word is spelled correctly, it will show 'you entered true ...
- 01-16-2010 #1Just Joined!
- Join Date
- Dec 2009
- Posts
- 28
ispell question
hello friends,,
my problem is about ispell
when i enter three argument to a script which is coded.
if the word is spelled correctly, it will show 'you entered true word'
if the word is misspelled, it will show 'you entered wrong word"
if you cannot enter an argument, it will show you 'no argument and exit'
if [[ -z $1 ]]; then echo 'No argument is given, the script exits'; else echo ... ?
how can i do it?
i want to control it with 'echo word | ispell -l'
thanks for your answers.
- 01-24-2010 #2Just Joined!
- Join Date
- Jan 2010
- Posts
- 4
You could do something like the below shell script. Store the output of "ispell -l" in a variable, then test to see if it's not empty ( -n ).
Code:#!/bin/bash if [ $# -eq 0 ] then echo "No arguments given. Exiting." exit 1 fi ispell_out=$(echo $1 | ispell -l) if [ -n "$ispell_out" ] then echo "Misspelled word: $1" else echo "Correctly spelled word: $1" fi


Reply With Quote