11NVuriti
Badges: 0
Rep:
?
#1
Report Thread starter 5 years ago
#1
Does anyone here use Linux on a regular basis?
0
reply
Binary Freak
Badges: 18
Rep:
?
#2
Report 5 years ago
#2
(Original post by 11NVuriti)
Does anyone here use Linux on a regular basis?
On a regular basis yeah.. Got a problem?
0
reply
11NVuriti
Badges: 0
Rep:
?
#3
Report Thread starter 5 years ago
#3
kinda... can you please explain the difference between these two basic commands? It's confusing me:
cd /etc
cd /
0
reply
Binary Freak
Badges: 18
Rep:
?
#4
Report 5 years ago
#4
(Original post by 11NVuriti)
kinda... can you please explain the difference between these two basic commands? It's confusing me:
cd /etc
cd /
Well both of them are just absolute paths that go to the whichever directory specified..

cd /etc - That puts you in the /etc subdirectory -- The directory stores quite a lot of networking files and encryption files. Well the configuration files

cd / - That's the master directory for the subdirectories in Linux/Unix. Also known as the master/high directory.

If you want to look into it further then take a look at the directory structure for Linux
0
reply
11NVuriti
Badges: 0
Rep:
?
#5
Report Thread starter 5 years ago
#5
Thank you thats really helped
0
reply
11NVuriti
Badges: 0
Rep:
?
#6
Report Thread starter 5 years ago
#6
(Original post by Binary Freak)
Well both of them are just absolute paths that go to the whichever directory specified..

cd /etc - That puts you in the /etc subdirectory -- The directory stores quite a lot of networking files and encryption files. Well the configuration files

cd / - That's the master directory for the subdirectories in Linux/Unix. Also known as the master/high directory.

If you want to look into it further then take a look at the directory structure for Linux
Thanks again for clarifying that for me.
I am currently working on another shell script.
I know this script automates the creation of a user:

#!/bin/bash# Script to add a user to Linux systemif [ $(id -u) -eq 0 ]; then read -p "Enter username : " username read -s -p "Enter password : " password egrep "^$username" /etc/passwd >/dev/null if [ $? -eq 0 ]; then echo "$username exists!" exit 1 else pass=$(perl -e 'print crypt($ARGV[0], "password")' $password) useradd -m -p $pass $username [ $? -eq 0 ] && echo "User has been added to system!" || echo "Failed to add a user!" fielse echo "Only root may add a user to the system" exit 2fiBut how would I edit it so it also adds the users into two specific groups?Any help would be appreciated...
0
reply
Binary Freak
Badges: 18
Rep:
?
#7
Report 5 years ago
#7
(Original post by 11NVuriti)
Thanks again for clarifying that for me.
I am currently working on another shell script.
I know this script automates the creation of a user:

#!/bin/bash# Script to add a user to Linux systemif [ $(id -u) -eq 0 ]; then read -p "Enter username : " username read -s -p "Enter password : " password egrep "^$username" /etc/passwd >/dev/null if [ $? -eq 0 ]; then echo "$username exists!" exit 1 else pass=$(perl -e 'print crypt($ARGV[0], "password")' $password) useradd -m -p $pass $username [ $? -eq 0 ] && echo "User has been added to system!" || echo "Failed to add a user!" fielse echo "Only root may add a user to the system" exit 2fiBut how would I edit it so it also adds the users into two specific groups?Any help would be appreciated...
Not done something like this for a while.. But if I recall you'd need an associative array in which the users are contained then have the groups stored in the values.. If that makes sense?

If you need help with the script itself then I'll try and see what I can come up with later since I'm just finishing off a bit of work
0
reply
11NVuriti
Badges: 0
Rep:
?
#8
Report Thread starter 5 years ago
#8
(Original post by Binary Freak)
Not done something like this for a while.. But if I recall you'd need an associative array in which the users are contained then have the groups stored in the values.. If that makes sense?

If you need help with the script itself then I'll try and see what I can come up with later since I'm just finishing off a bit of work
I guess I kinda get what you mean, but what if I add a menu?
bash.cyberciti.biz/decision-making/menu-driven-shell-script/

0
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

Current uni students - are you thinking of dropping out of university?

Yes, I'm seriously considering dropping out (176)
14.53%
I'm not sure (56)
4.62%
No, I'm going to stick it out for now (354)
29.23%
I have already dropped out (35)
2.89%
I'm not a current university student (590)
48.72%

Watched Threads

View All
Latest
My Feed