Julius acoustic model on cygwin with HTK - cygwin

$ HDMan -A -D -T l -m -w wlist -n monophonesl -i -l dlog dict ../lexicon/voxforge_lexicon
C:\cygwin\HTK\htk-3.3-windows-binary\htk\HDMan.exe -A -D -T l -m -w wlist -n monophonesl -i -l dlog dict ../lexicon/voxforge_lexicon
No HTK Configuration Parameters Set
ERROR [+5021] GetChkedInt: Integer Arg Required for T option
FATAL ERROR - Terminating program C:\cygwin\HTK\htk-3.3-windows-binary\htk\HDMan.exe
I am on the third step to train julius using voxforge training. I created lexicon file and global.ded file as mentioned in the text. wheni run the command on cygwin oi get this error. I have been tring stuff but cannot figure it out. can you help me on this.?

-T l
The right command includes number 1, not the letter l. Use
-T 1
To avoid such issues in the future use a font which distinguish them. Copy-paste commands instead of retyping them. Read the message from the tool and try to understand, it already says you where the problem is.

Related

How to display as a table combined output of a program and a file and watch it in 1 sec

I have a program isig, that displays 18 rows of data, want to combine it with text file info1.txt that also has 18 rows of additional data into a table view and watch it in 1sec interval.
My command to display the table is:
pr -m -t <(isig 4001+18) info1.txt
And if I add watch:
watch -n 1 'pr -m -t <(isig 4001+18) info1.txt'
I get:
sh: 1: Syntax error: "(" unexpected
Is there a way to achieve this in bash command line
Process substitution (<()) is a Bash extension, not available in standard shell. Get watch to run your command in Bash instead:
watch -n 1 'bash -c "pr -m -t <(isig 4001+18) info1.txt"'

How to make my script actually execute, rathern than just print to console?

I'm trying to make the following snippet execute automatically. I have enabled permissions. I'm new to both Linux and shell scripting, and know very little about it.
Here is the code I would like to execute:
raspivid -t -0 -w 1080 -h 720 -awb auto -fps 30 -rot 90 -b 1200000
-o -|ffmpeg -loglevel quiet -i - -vcodec copy -an -f flv
-metadata streamName=myStream tcp://0.0.0.0:6666&
It works fine when I paste it into the command line and press "enter". However, I need it to execute automatically, so I'm trying to write a script to do that.
This is what I've tried to do in nano editor:
#!/bin/bash
echo "...above code here..."
This only prints to console (probably obvious), but how can I make it execute?
1. I have made it executable (I believe) by using
sudo chmod +x start2s.sh
I have also enabled permissions like this:
sudo chmod 755 start2s.sh
When I type
sh start2s.sh
it just prints to console. Any help is appreciated.
Some basic scripting tips:
#!/bin/bash
echo 'ls'
will print
ls
and
#!/bin/bash
ls
will give you the output of ls.
In general, you will put an echo in your script
if you have something to output from the script
during development: if you want to be sure the command and arguments are correct, for example, because the command destroys things.
In the latter case, you will remove the echo from the script once you have verified the corretness.

How can I split a file by pattern on GNU linux? (split command does not have a -p flag on GNU as it does on BSD)

Background: I have a very large .sql file, which causes a timeout when I import it into my MySQL server. To fix this in Mac OS X, i run: split -p 'DROP TABLE IF EXISTS' my-backup-file.sql which causes a series of smaller files which then don't cause the timeout.
My issue is:
split -p 'pattern' my-backup-file.sql works fine on Mac OS but not on GNU linux such as Ubuntu as far as I understand.
I cannot run something like `docker run -v $(pwd):/workspace some/freebsdimage /bin/bash -c 'cd /workspace && split -p pattern my-backup-file.sql' because I can't run a freebsd docker image on a non-freebsd docker host.
What alternative is there in Ubuntu to split a file into smaller files every time a pattern occurs?
The answer which works for me, as #Mark Plotnick states above, is
csplit -k inputfile '/pattern/' '{99999}'

How to run command during Docker build which requires a tty?

I have some script I need to run during a Docker build which requires a tty (which Docker does not provide during a build). Under the hood the script uses the read command. With a tty, I can do things like (echo yes; echo no) | myscript.sh.
Without it I get strange errors I don't completely understand. So is there any way to use this script during the build (given that its not mine to modify?)
EDIT: Here's a more definite example of the error:
FROM ubuntu:14.04
RUN echo yes | read
which fails with:
Step 0 : FROM ubuntu:14.04
---> 826544226fdc
Step 1 : RUN echo yes | read
---> Running in 4d49fd03b38b
/bin/sh: 1: read: arg count
The command '/bin/sh -c echo yes | read' returned a non-zero code: 2
RUN <command> in Dockerfile reference:
shell form, the command is run in a shell, which by default is /bin/sh -c on Linux or cmd /S /C on Windows
let's see what exactly /bin/sh is in ubuntu:14.04:
$ docker run -it --rm ubuntu:14.04 bash
root#7bdcaf403396:/# ls -n /bin/sh
lrwxrwxrwx 1 0 0 4 Feb 19 2014 /bin/sh -> dash
/bin/sh is a symbolic link of dash, see read function in dash:
$ man dash
...
read [-p prompt] [-r] variable [...]
The prompt is printed if the -p option is specified and the standard input is a terminal. Then a line
is read from the standard input. The trailing newline is deleted from the line and the line is split as
described in the section on word splitting above, and the pieces are assigned to the variables in order.
At least one variable must be specified. If there are more pieces than variables, the remaining pieces
(along with the characters in IFS that separated them) are assigned to the last variable. If there are
more variables than pieces, the remaining variables are assigned the null string. The read builtin will
indicate success unless EOF is encountered on input, in which case failure is returned.
By default, unless the -r option is specified, the backslash ``\'' acts as an escape character, causing
the following character to be treated literally. If a backslash is followed by a newline, the backslash
and the newline will be deleted.
...
read function in dash:
At least one variable must be specified.
let's see read function in bash:
$ man bash
...
read [-ers] [-a aname] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name...]
If no names are supplied, the line read is assigned to the variable REPLY. The return code is zero,
unless end-of-file is encountered, read times out (in which case the return code is greater than
128), or an invalid file descriptor is supplied as the argument to -u.
...
So I guess your script myscript.sh is start with #!/bin/bash or something else but not /bin/sh.
Also, you can change your Dockerfile like below:
FROM ubuntu:14.04
RUN echo yes | read ENV_NAME
Links:
https://docs.docker.com/engine/reference/builder/
http://linux.die.net/man/1/dash
http://linux.die.net/man/1/bash
Short answer : You can't do it straightly because docker build or either buildx didn't implement [/dev/tty, /dev/console]. But there is a hacky solution where you can achieve what you need but I highly discourage using it since it break the concept of CI. That's why docker didn't implement it.
Hacky solution
FROM ubuntu:14.04
RUN echo yes | read #tty requirement command
As mentioned in docker reference document the RUN consist of two stage, first is execution of command and the second is commit to the image as a new layer. So you can do the stages manually on your own where we will provide tty to first stage(execution) and then commit the result.
Code:
cd
cat >> tty_wrapper.sh << EOF
echo yes | read ## Your command which needs tty
rm /home/tty_wrapper.sh
EOF
docker run --interactive --tty --detach --privileged --name name1 ubuntu:14.04
docker cp tty_wrapper.sh name1:/home/
docker exec name1 bash -c "cd /home && chmod +x tty_wrapper.sh && ./tty_wrapper.sh "
docker commit name1 your:tag
Your new image is ready.
Here is a description about the code.
At first we make a bash script which wrap our tty to it and then remove itself after fist execute. Then we run a container with provided tty option(you can remove privileged if you don't need). Next step we copy wrapped bash script inside container and do the execution & commit stage on our own.
You don't need a tty for feeding your data to your script . just doing something like (echo yes; echo no) | myscript.sh as you suggested will do. also please make sure you copy your file first before trying to execute it . something like COPY myscript.sh myscript.sh
Most likely you don't need a tty. As the comment on the question shows, even the example provided is a situation where the read command was not properly called. A tty would turn the build into an interactive terminal process, which doesn't translate well to automated builds that may be run from tools without terminals.
If you need a tty, then there's the C library call to openpty that you would use when forking a process that includes a pseudo tty. You may be able to solve your problem with a tool like expect, but it's been so long that I don't remember if it creates a ptty or not. Alternatively, if your application can't be built automatically, you can manually perform the steps in a running container, and then docker commit the resulting container to make an image.
I'd recommend against any of those and to work out the procedure to build your application and install it in a non-interactive fashion. Depending on the application, it may be easier to modify the installer itself.

ssh ignore special character

I'm on an RHEL server trying to SSH to a windows server using the following command -
ssh -p 5950 -i /home/svcacct/.ssh/serverkey svcacct#servername prog Alias=database add -a blah -p "var1=shared_data\Repost, var2=1771, var3=1000 - S&P Index Summary, var4=SP, var5=20150129"
It then fails with the following message -
'P' is not recognized as an internal or external command,
operable program or batch file.
The reason seems to be that linux is using the '&' as a special character which I don't want it to do.
It seems you forgot to escape some quotes:
ssh -p 5950 -i /home/svcacct/.ssh/serverkey svcacct#servername prog Alias=database add -a blah -p "var1=shared_data\Repost, var2=1771, var3=\"1000 - S&P Index Summary\", var4=SP, var5=20150129"

Resources