Problem in making a script
amritpal pathak
amritpalpathak1 at gmail.com
Wed Jun 29 13:25:09 UTC 2011
On Wed, Jun 29, 2011 at 8:53 AM, Nils Kassube <kassube at gmx.net> wrote:
> amritpal pathak wrote:
> > On Wed, Jun 29, 2011 at 7:46 AM, Nils Kassube <kassube at gmx.net> wrote:
> > > amritpal pathak wrote:
> > > > > How can i do it in the script?
> > > > >
> > > > > well i found i can accept user's input by using read command
> > > > > in scripting .but still i have another problem.
> > > > >
> > > > I have to edit the config file i.e I want that
> > > >
> > > > input given by the users will be replace by config file's entries
> > > > at particuler line.
> > > > please tell me how to replace user's input with config file's
> > > > particuler line's stuff?
> > > >
> > > > i am using gedit text editor.
> > >
> > > If you want to do it with a script, gedit isn't the right tool. Use
> > > sed instead which is made for this task. Here is once more the
> > > link to the sed manual:
> > >
> > > <http://www.gnu.org/software/sed/manual/html_node/index.html>
> > >
> > > If you need further assistance, please tell us how you know which
> > > line to replace. Is it a particular line number or a text pattern
> >
> > particuler line number.
>
> In this case I'll prefer the head and tail commands (I'm too lazy to
> read the sed manual). This should do the trick - set the variables
> accordingly before you call this untested snippet:
> thanks for it.can you pls help to understanding these variables.
> TEMP=$(mktemp)
>
for what it is?
> head -n $(($LINENUM - 1)) "$CONFFILE" > "$TEMP"
>
Here LINENUM to be replaced with line number of config file? and
CONFFILE is name of file to be edit?
> echo "$USERINPUT" >> "$TEMP"
>
ok USERINPUT Is name of variable in which input of user is placed.
Thanks you Sir
amritpalpathakgne.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20110629/33515217/attachment.html>
More information about the ubuntu-users
mailing list