shell

ZOC Terminal:text has been cut halfway down the page

左心房为你撑大大i 提交于 2021-02-17 06:16:05
问题 I work with ZOC terminal installed at windows 7 in order to communicate with device that has Linux operating system zoc picture. The communication via terminal works great but recently the text has been cut halfway down the page. attached picture . 回答1: The picture shows 24 lines. You can get this behavior if your terminal description sets scrolling margins to 24 lines — as some might do, when initializing the terminal if the application assumes that the screen has 24 lines. Since ZOC could

Passing multiple variables from python script to shell script

十年热恋 提交于 2021-02-17 04:44:42
问题 I am trying to run a shell script from python by exporting the python variable to the shell script instead of directly reading them from the user. A question regarding passing array values as variable to shell script was answered successfully earlier and helped me to pass the values in an array as a input variable to the shell script. I want to export multiple variables such as FLUID , TTYPE and FLIBRARY from the following python script: FLUID="MDM" TTYPE=0 FLIBRARY="RefProp" HSPACE=[0.01, 0

Passing multiple variables from python script to shell script

落花浮王杯 提交于 2021-02-17 04:44:11
问题 I am trying to run a shell script from python by exporting the python variable to the shell script instead of directly reading them from the user. A question regarding passing array values as variable to shell script was answered successfully earlier and helped me to pass the values in an array as a input variable to the shell script. I want to export multiple variables such as FLUID , TTYPE and FLIBRARY from the following python script: FLUID="MDM" TTYPE=0 FLIBRARY="RefProp" HSPACE=[0.01, 0

Quotes within HERE document in shell scripts

牧云@^-^@ 提交于 2021-02-17 02:53:31
问题 G'day, I'm getting syntax errors when working with a shell script like the following: ssh root@mm-$user-vm-lenny <<EOF check_dbtag=`grep "<<include /home/$user/cvs/dbtag.conf>>" /etc/dbtag.conf` if [ "$check_dbtag" == "" ] then echo '<<include /home/$user/cvs/dbtag.conf>>' >> /etc/dbtag.conf fi EOF The error I'm getting is -bash: line 21: syntax error near unexpected token 'newline' -bash: line 21: 'check_dbtag=<<include /home/thomasw/cvs/dbtag.conf>>' However, I don't get it anymore if I

Quotes within HERE document in shell scripts

只愿长相守 提交于 2021-02-17 02:52:11
问题 G'day, I'm getting syntax errors when working with a shell script like the following: ssh root@mm-$user-vm-lenny <<EOF check_dbtag=`grep "<<include /home/$user/cvs/dbtag.conf>>" /etc/dbtag.conf` if [ "$check_dbtag" == "" ] then echo '<<include /home/$user/cvs/dbtag.conf>>' >> /etc/dbtag.conf fi EOF The error I'm getting is -bash: line 21: syntax error near unexpected token 'newline' -bash: line 21: 'check_dbtag=<<include /home/thomasw/cvs/dbtag.conf>>' However, I don't get it anymore if I

clojure.java.sh: No such file or directory

非 Y 不嫁゛ 提交于 2021-02-17 02:14:29
问题 I've written a program to assemble .dot files, and want to use Clojure's sh to give a compile command. Specifically, I use the following function to do it: (defn compile-graphviz "Dumps graphviz-string to a file, then compiles it using dot." [graphviz-string] (do (spit "./tree.dot" graphviz-string) (sh "dot -Tpng \"/.tree.dot\" -o\"/.tree.png\""))) However, when I run this, the second part fails, giving the following error message at the REPL: IOException error=2, No such file or directory

cd to a folder name starting with tilde (~) in bash script

此生再无相见时 提交于 2021-02-16 21:15:29
问题 I'm trying to create a very simple bash script that does the following: Inputs the user to enter a project folder Sets the value entered in a variable cd to the folder entered remove the readme.md file From what I've read around I've come up with this: #!/bin/bash echo "Enter the project folder path:" read -e DESTINATION_FOLDER cd "$DESTINATION_FOLDER" rm -rf "$DESTINATION_FOLDER/readme.md" The folder's path I entered was ~/Dropbox/myproject And the error I get is the one below. However that

Split file by vector of line numbers

爱⌒轻易说出口 提交于 2021-02-16 20:10:35
问题 I have a large file, about 10GB. I have a vector of line numbers which I would like to use to split the file. Ideally I would like to accomplish this using command-line utilities. As a regex: File: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Vector of line numbers: 2 5 Desired output: File 1: 1 2 3 File 2: 4 5 6 7 8 9 10 11 12 File 3: 13 14 15 16 17 18 回答1: This might work for you: csplit -z file 2 5 or if you want regexp: csplit -z file /2/ /5/ With the default values, the output files will

How to execute the same loop for 1 hour in bash/ linux scripting?

◇◆丶佛笑我妖孽 提交于 2021-02-16 16:22:08
问题 I want to open and close some web pages with random intervals for an hour. So far i have written the innards FILE=webpages TIMES=0 while test $TIMES -lt 10 do #Picks random line(Website) from FILE TEMPWEB=`shuf -n 1 $FILE` echo "Opening" $TEMPWEB #Opens TEMPWEB xdg-open $TEMPWEB sleep 10 #Kills firefox ps -e | grep firefox | sed 's/\(.[0-9]*\).*/\1/' | xargs kill TIMES=$(($TIMES+1)) done So I'm am missing the while condition. I want something like: TIMER = 0h 0m 0s while( TIMER < 1 h) ....

Bash Loop Through Variable With Rows and Columns

痞子三分冷 提交于 2021-02-16 15:30:36
问题 After searching around for many hours testing different solutions, I've yet to find a working solution. Bash and Shell Scripting is not my strongest area. I have a variable which has rows (new lines) and columns (tab separated). What I want to do is loop through the rows and get 'Column X' then put that item into a variable so I can do something with that Cell. i.e. echo out for example. There are an unknown number of rows, but known number of columns, so that it is possible to always get