As a part of my homework exercise, i am finding it difficult to execute the following two commands. Can you please rectify the error in it. Thanks in advance
Write a program, that will take a file which has a set of directories, and will look into these directories and their sub directories for any files named core.* and *.o and will print a report of all such files found. (you can use find)
For the above program i attempted to do like this.
cat prog1 | xargs find /$0 -name 'core.*' or '*.o'
But I am getting the following error. (prog1 is a file containing list of directories)
find: paths must precede expression: perl
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
The next question is:
Write a script that will go through the /etc/passwd file, and from this print a list of users in the system, their home directory and the shell that they are using
For which I tried the following:
awk '{print "USER \t\t HOME \t\t BASH \n split($0,a,":")}
{print $a[1] \t\t $a[6] \t\t $a[7]}' /etc/passwd
I tried googling and seeing the man entries but I don't understand the error. Also can you provide some useful links to shell scripting for beginners?