LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 02-17-2016, 12:04 PM   #1
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Rep: Reputation: Disabled
bash script - editing some files to add more lines


hi all,

i have created a basic kickstart file and its great it all works (complete unattended install)

but i want edit /etc/group to add new groups and add a user to that group eg

group_name:x:500:root

and also make a directory eg

mkdir /mnt/new_dir

and also put a new entry in fstab to mount it to that local directory eg

ip_address:/remote_share_path /mnt/new_dir nfs defaults 0 0

cheers

rob
 
Old 02-18-2016, 06:12 AM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,763

Rep: Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764
Need More Data.

Fair enough.
So, is something stopping you?
 
Old 02-18-2016, 06:15 AM   #3
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
i need to know the command to write the script so it adds these lines to the files
 
Old 02-18-2016, 07:50 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,039

Rep: Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347
man groupadd
you can use any editor you want, like vi, nano, gedit, emacs....
I do not understand what do you really need

Last edited by pan64; 02-18-2016 at 07:53 AM.
 
Old 02-18-2016, 09:43 AM   #5
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
sorted

#!/bin/bash

mkdir -p /vol/cha-archive

echo "cha:/ifs/data/cha/cha-archive /vol/cha-archive nfs defaults 0 0" >> /etc/fstab

mount -a

echo "cha-archive:x:6001:root" >> /etc/group
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] bash script reading specified lines from multiple files and concatenating into one TullyGirl Linux - Newbie 6 03-22-2013 10:29 PM
[SOLVED] How to add text on image files in bash script bal_nair1 Programming 10 07-26-2012 05:55 AM
Bash script to find and remove similar lines from multiple files linuxquestion1 Programming 9 07-13-2011 01:45 AM
commands for bash script that handles files of varying number of lines BBFeltham Linux - Newbie 1 07-26-2008 10:18 AM
[bash] removing or editing lines in file Erhnam Programming 12 03-15-2005 07:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 05:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration