Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Use this to open in emacs, I assume.
- #!/bin/bash
- echo "Hello World!"
- echo Hello World! #Seems to work fine even without double quotes
- numberofcharacters=0
- index=0
- count=0
- char=0
- x[0]=0
- y[0]=0
- for file in /bin/* #/bin/whatevercommand
- do
- {
- echo $file
- string=$file #NO SPACES, OR ELSE IT IS INTERPRETED AS A COMMAND
- echo $string #should print duplicates
- echo ${string:5:1}
- character=${string:5:1}
- if [[ $character == [a-z] ]] #Can only use == becuase of double "test"
- then
- {
- echo "Its a character" $character #If it was just [] need to use -eq
- echo "Char is " $char
- if [[ $char==$character ]]
- then
- { echo "Accessed 1 "
- current=${y[index]}
- (( y[index]=$current+1))
- }
- else
- {
- echo "Accessed 2"
- char=$character
- ((index++))
- y[index]=1 #It equals 1 because we just saw the new character
- x[index]=$character
- }
- fi
- }
- fi
- }
- done
- #echo "Y @ " ${y[@]}
- echo "X @ " ${x[@]}
- echo "Char " $char
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement