I am currently writing an ncurses shell and in order to read input it is important to read it character by character and hence I am using the mvwgetch command. And incrementing a counter as it reads character by character. The problem is that whenever I press a an arrow key or a backspace their output is being printed. So,
Tag: shell
How do I grep or sed in a continuous stream of characters?
I have a program that output some text and then a continuous stream of characters: I want to exit this program as soon as “A” is seen in the output and I tried: However, it seems like grep doesn’t see the “A”s until the perl program exits. I also tried with sed with no luck; Any ideas how I can
Unable to pass filename with space through variable to SCP command
I am trying to set the variable $file as “Unavailable Voucher’s Report_Apr-2017.txt”. It is getting set to the variable successfully. But I am getting an error when I use this variable in a SCP command inside my script. I have tried to replace the ‘ ‘(space) with ‘ ‘(escaping space), still no use. Error be like: Answer Try to double
Is there any faster way to grep the pattern or to increase the speed of while loop?
this loop is taking time because lacks of entry in main_file. Answer Your current approach is very inefficient – the whole loop could be done in a single grep, with the -f option. -F treats lines in file as strings, not patterns -x looks for exact matching line (if that is what you want) -f file reads the lines from
Redirect the standard output [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 5 years ago. Improve this question Hello and thank you for attention. I am writing my own
Append input URL from user to variable in file using shell script
I have one file test.txt it have already some data named export website_URL and export username= test.txt start.sh here creating new file from test.txt writing data in to data.txt file here if I put input to website_URL=”http://stackoverflow.com/questions/6543841/php-cli-getting-input-from-user-and-then-dumping-into-variable-possible” it is failing with sed: -e expression #1, char 71: unknown option to `s’ this error . So I can store any url
How to log to file inside brackground “watch” command?
I trying to set a watch task running in background and printing to a log file, but when i use the command in background, the files is not written. This is the command that i’m using: then the terminal prints: i try to kill the process: so i want to see the log: But the file is empty ☹️. What
How to store log files of a shell script in HDFS
I have shell script in HDFS. I want to collect the logs for this script in HDFS only. The contents of the script are below: The logs are not appending to the files. only the files are being created. How can I get the files to have the result of the function to be appended in HDFS Answer The logs
script to check script is running and start it, if it’s stopped
I have a script with this name : Run.sh I run this script with this command : I don’t like stop this script but this script Suddenly stops and need run again. I need a script to check it , if my run.sh stopped , run it again. this is run.sh codes: And i want run this script at boot
How to get number of worker, cores, ram from HDI cluster
Here is my scenario. I am creating HDI cluster and installing my custom application using ARM template. I need following values to be configured for my application using Shell script. Installing my application using CustomScript option in ARM template. Number of worker nodes Number of cores per worker node RAM per worker node RAM per head node Number of cores