Sponsored Content
Full Discussion: Help with incomplete Code
Top Forums UNIX for Dummies Questions & Answers Help with incomplete Code Post 302804515 by Geekie on Wednesday 8th of May 2013 06:01:55 PM
Old 05-08-2013
Help with incomplete Code

Hello,

Since i am new in shell scripting, i need some help from you guys. Smilie

I am trying to implement an automata that reflects the attached photo..
The main idea behind is to take an array of (0 & 1)s from the user and terminate it by "end". Then, the string is send to the function to check wether it belongs to the automata or not. The bit string belongs to the automata only if the last bit ends up in a state that has a double circles. If it has one circle that means it does not belong.

I am stuck in how exactly i should automate the process in "case".

Any suggestions of how i can do the function..



Code:
#!/bin/bash

function  autometa {

for (( i = 0 ; i<${#X[@]} ; i++ ))
do


case {X[$i]} in

0)
#HELP
;;
1)
#HELP
;;
*) echo "Invalid"
;;

esac
done
}

i=0

while :

do
echo "Please Enter A String of 0 & 1,  Write (end) to terminate"
read x

if [ $x = "end" ]
then break
fi

  X[$i]=$x
  i=$((i+1))


done

autometa $X 
echo ${X[@]}

Help with incomplete Code-20130508223853845-1jpg
 

9 More Discussions You Might Find Interesting

1. IP Networking

Incomplete three way handshake

I've got a strange problem with a single mail sender (it is one of those large free mail providers). My mail server works well with thousands of senders but not this one, so we have made a connection dump and it seems that the three way handshake is not completed 15:55:59.177431 IP... (0 Replies)
Discussion started by: 3wayTrouble
0 Replies

2. Shell Programming and Scripting

How to ignore incomplete files

On Solaris & AIX, suppose there is a directory 'dir'. Log files of size approx 1MB are continuously being deposited here by scp command. I have a script that scans this dir every 5 mins and moves away the log files that have been deposited so far. How do I design my script so that I pick up... (6 Replies)
Discussion started by: sentak
6 Replies

3. Solaris

How to ignore incomplete files

On Solaris, suppose there is a directory 'dir'. Log files of size approx 1MB are continuously being deposited here by scp command. I have a script that scans this dir every 5 mins and moves away the log files that have been deposited so far. How do I design my script so that I pick up *only*... (6 Replies)
Discussion started by: sentak
6 Replies

4. Shell Programming and Scripting

incomplete last line

How do I find through script if a contains "incomplete last line". If it does then only insert a new line character as:: echo "" >> filename.txt (4 Replies)
Discussion started by: PRKS
4 Replies

5. Shell Programming and Scripting

script incomplete

#!/bin/bash DIR=/dir/$(date +%y%m) || mkdir "$DIR" for D in $@ # obtem os argumentos do cp /usr/home/backup if backup=null then mkdir backup done How can I complete that script, that's not value, can someone help me complete this... The point of the program is: - If the... (1 Reply)
Discussion started by: strshel
1 Replies

6. Shell Programming and Scripting

Incomplete last line

I need help with appending the last line to the file only if the last line is incomplete. I tried awk 1 filename > new_filename but it appends to every file and I only want to append to the file if the last line is incomplete (3 Replies)
Discussion started by: smee
3 Replies

7. UNIX for Dummies Questions & Answers

Copy operation incomplete

I am logged into AIX 6.1 as a root user. I tried copying about 190GB of data to a different folder. cp -R /u01/data/scope /CY/backup I got the message: cp: Requested a write of 4096 bytes, but wrote only 3584. When the copy operation completed, I checked the /CY/backup/scope folder and... (3 Replies)
Discussion started by: shoefiend
3 Replies

8. Shell Programming and Scripting

Adding incomplete HTML code to a file

Hi folks, I am scraping data from the Internet that has the format similar to what's on this page -- Trigger Notice Report The code I've written for scraping and storing results works fine when the HTML code is well written, but not when there are mistakes. In particular, the code breaks when... (4 Replies)
Discussion started by: ksk
4 Replies

9. UNIX for Dummies Questions & Answers

Delete incomplete data

Hi all, Please help with the following example. I want to keep all people in the data, who at least have Firstname or Lastname or both and at least 1 row of Details. So, Person4 lacking both Firstname and Lastname will be deleted, Person5 with no Details will be deleted. Firstname,Lastname... (3 Replies)
Discussion started by: ritakadm
3 Replies
fsaparse(3gv)															     fsaparse(3gv)

NAME
fsaparse - parse a word-acceptor automaton file SYNOPSIS
#include "wa.h" fsafparse(fp, fsa) FILE *fp; Fsa *fsa; DESCRIPTION
fsafparse parses a word-acceptor automaton file in the format described by DEAGL ("Data Exchange for Automata and Groups Language") (but see the BUGS section below). fp should be a pointer to an open file containing the automaton. fsa should be a pointer to an Fsa struture as defined in "fsa.h". Upon return, the automaton will have been written into this structure. RETURN VALUES
On success, fsafparse() returns 1. On failure, it returns 0. SEE ALSO
getwordlist(3), getmatlist(3), fgetmatlist(3), getmatlist(1), automata(1) BUGS
fsafparse is meant specifically for use with getwordlist(3) and getmatlist(3). It does not recognize the full language described by DEAGL. It only recognizes that part of it which was present in the word-acceptor files that I was working with when I wrote it. I think this may be sufficient for all word-acceptor automata, but I am not sure of this. Please let me know if you find word-acceptor files for which this doesn't work. AUTHOR
Mark Phillips The Geometry Center Sat Mar 23 22:01:32 1991 fsaparse(3gv)
All times are GMT -4. The time now is 01:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy