LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-12-2018, 10:44 PM   #1
TheGrey
LQ Newbie
 
Registered: Jul 2018
Posts: 4

Rep: Reputation: Disabled
Redirection issues using ls


Hello everyone,
I am in a Linux class and I will paste the screen of where I am stuck:
OK maybe not.

The instructions read:
By using the commands and utilities you just learned, complete the following tasks:

In the ~/workspace/project-log directory, create a file named changelog.txt with the following content and format:

Changelog
Version: 1.0

Redirect the output of the ls command to a file named file-list.txt in the ~/workspace/project-log directory

The first part I did nice and easy. The redirect is killing me. I tried to see if I could trick Codio by just creating another file, but it said missing ls. Then I got it to create the new file with ls -l but the content was different.

I am not understanding how to use ls to make the new file say the same thing the original file did.

Thank you for any assistance.
 
Old 07-12-2018, 10:54 PM   #2
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.5
Posts: 1,806

Rep: Reputation: 564Reputation: 564Reputation: 564Reputation: 564Reputation: 564Reputation: 564
Quote:
The content was different
Different than what? There’s nothing in those instructions about the content of file-list.txt.

You should probably direct your question to your instructor.
 
Old 07-12-2018, 11:00 PM   #3
TheGrey
LQ Newbie
 
Registered: Jul 2018
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by scasey View Post
Different than what? There’s nothing in those instructions about the content of file-list.txt.

You should probably direct your question to your instructor.
Redirect the output of the ls command to a file named file-list.txt in the ~/workspace/project-log directory.

That's part 2 of the problem.
If I do ls - l, I get different output than the Changelog Version: 1.0
 
Old 07-12-2018, 11:16 PM   #4
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.5
Posts: 1,806

Rep: Reputation: 564Reputation: 564Reputation: 564Reputation: 564Reputation: 564Reputation: 564
Quote:
Originally Posted by TheGrey View Post
Redirect the output of the ls command to a file named file-list.txt in the ~/workspace/project-log directory.

That's part 2 of the problem.
If I do ls - l, I get different output than the Changelog Version: 1.0
Why do you expect the output of the last command to be the same?? There’s nothing in your directions that suggests it should be...
...nor should it be. Talk with your instructor.

Last edited by scasey; 07-12-2018 at 11:17 PM.
 
Old 07-12-2018, 11:21 PM   #5
TheGrey
LQ Newbie
 
Registered: Jul 2018
Posts: 4

Original Poster
Rep: Reputation: Disabled
I was assuming that the error message said it was to be the same, I didn't post it originally my apologies.

[Error ] Task 2. Expected: 'ls' ~/workspace/ content to match file named ~/workspace/project-log/file-list.txt content. Try again.

Thats what I get when I tried

ls -l >> ~/workspace/project-log/file-list.txt

Same error when I try
ls -l > ~/workspace/project-log/file-list.txt

Nevermind, I just noticed the -l....solved it.

Last edited by TheGrey; 07-12-2018 at 11:54 PM. Reason: solved it
 
Old 07-13-2018, 02:06 AM   #6
MadeInGermany
Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 899

Rep: Reputation: 387Reputation: 387Reputation: 387Reputation: 387
Perhaps you stumbled over the fact that "ls" without argument "-l" or "-1" prints multi-column when it goes to the screen.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
USB redirection issues on WinXP guest, KVM host (created with virt-manager) gradinaruvasile Linux - Virtualization and Cloud 2 12-07-2015 07:00 AM
DNS issues, Downloading issues, Web issues. UbuntuHelp Linux - Networking 1 08-28-2012 07:34 AM
Shell script: stdin redirection + multiple curl process issues fernandomm Programming 1 07-04-2010 08:10 AM
redirection kkpal Programming 4 11-05-2007 10:24 PM
redirection rblampain Linux - Server 0 09-29-2007 12:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:37 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration