How to embed data instead of reading user input from an array?
Hello,
I am running under ubuntu1 14.04 and I have a script which is sending given process names to vanish so that I'd see less output when I run most popular tools like top etc in terminal window. In usual method it works.
Whenever I restart the system, I have to enter the same data from keyboard at startup. since it was asking me to enter data from command line, I am unable to run it from systemd/services as a startup process. I'm looking for a solution to embed the keywords into below script:
start.sh
When I run the script, ./start.sh
What I wish to accomplish is not convert user input to array, just need to add watchdog , migration and other phrases into this script so that it will run at startup without asking any questions.
I removed all lines but just kept last two lines, and run them like :
I have a process that requires me to read data from huge log files and find the most recent entry on a per-user basis. The number of users may fluctuate wildly month to month, so I can't code for it with names or a set number of variables to capture the data, and the files are large so I don't... (7 Replies)
I am not able to capture the user input in this script(bash).There is prompt for user input.Could some one help me capture user input while reading afile?
while read line
do
echo "$i"
path1=$line
path2=`echo $line|sed s/new_dir/old_dir/`
echo "Do you want to replace?";... (4 Replies)
Hi all,
I have a little problem with my shell script (reading user input, save user input to variable, invisible characters in the log file :()
printf "1. What's your file path?"
/path/to/my/file
read -e FILE
I have invisible characters in my log file (e.g. <ESC> or ^G) when I'm... (3 Replies)
I need some help with this code below, i doesnt know why it will run twice with my function, but my function only got if else, any other way that can read line and put into array?
while read line; do
read -A array <<<$line
n=${#array}
for ((i=1;i<$n;i++)); do
print... (1 Reply)
I am writing a script where it uses yum to install. I need to read the user input for yum ie "y or n". If the user types "y", the script should continue running. If the user types "n" then the whole script should be terminated.
line1
line2
yum install package
line3
line4
From above,... (5 Replies)
Hi all,
I wrote a script that reads inputs from user and store in array named "input". The number of elements in the array is not fixed - determined only after user exit the while loop that reads the array values :
x=1
echo "Enter first value"
read input
while } != "exit" ]
do
... (1 Reply)
how do we read input from a user
e.g i want to ask a user to enter 6 sets of numbers
how do i control information from the user?
i have this.......
#!/bin/bash
echo "Please enter six numbers"
read number
echo $number >> file1
but this stops after the first number..how can i... (2 Replies)
Dear Friends,
I am doing a sh shell script , But I dont have any idea how to read value from user Keyboard and store them to an array .. Is it possible or not I am not also sure in sh shell script ?
EX:-
#! /bin/sh
read DATA
echo "DATA -" $DATA
echo "DATA -" $DATA
echo "DATA... (7 Replies)
Hye all,
I would like some help with reading in a file in which the data is seperated by commas. for instance:
input.dat:
1,2,34,/test
for the above case, the fn. will store the values into an array -> data as follows:
data = 1
data = 2
data = 34
data = /test
I am trying to write... (5 Replies)
Just want to learn how these are read into array but I don't seem to get it right what do I go wrong?
Below is the sample
Thanks
input
1 2 3 4
5 6 7 8
9 1 2 3
4 5 6 7
#!/usr/bin/perl
open (InFILE,"input");
while (<InFILE>) {
@ar = split ; (5 Replies)