Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6048757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:29:57+00:00 2026-05-23T07:29:57+00:00

As a part of my homework exercise, i am finding it difficult to execute

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:29:58+00:00Added an answer on May 23, 2026 at 7:29 am
    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) 
    

    I suggest following oneliner:

    find `paste -s -d' ' directories.list` -type f -name 'core.*' -or -name '*.o'
    

    Where directories.list contains directories names, one by line.

    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
    

    Try this:

    awk -F: 'BEGIN{print "USER\t\tHOME\t\tSHELL"}{printf("%s\t\t%s\t\t%s\n", $1, $6, $7)}' /etc/passwd
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As part of a homework assignment in Lisp, I am to use apply or
This is part of a homework assignment. I've got several questions asking find the
(this is indirectly a part of a much larger homework assignment) I have something
As part of a homework assignment, I have to program a simple chess game
I am a student, this is part of my homework. I have to Update
My homework question given is: How can you print the path of the current
I've been asked (as part of homework) to design a Java program that does
I am working on a program in C as a part of Homework in
as a part of a homework assignment, I'm trying to read a single char
so this is part of my homework assignment. need some help with it. my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.