Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions for homework 4: command line #26

Open
k8hertweck opened this issue Oct 31, 2019 · 20 comments
Open

Questions for homework 4: command line #26

k8hertweck opened this issue Oct 31, 2019 · 20 comments
Labels
homework questions about homework

Comments

@k8hertweck
Copy link
Collaborator

k8hertweck commented Oct 31, 2019

Homework questions here

@matsen and I are happy to answer questions about the homework here. For general questions about command line, please use #27

@k8hertweck k8hertweck added the homework questions about homework label Oct 31, 2019
@LABrumage
Copy link

For number 5, are the use of ImageMagick and parallel going to be discussed in class on Tuesday of next week? Thank you!

@k8hertweck
Copy link
Collaborator Author

@LABrumage Yes, we'll cover GNU parallel in the scripting section.

Everything you need to know about ImageMagick is included in the homework question. If you have other questions, I recommend looking at the documentation, or bringing specific questions for @matsen

@stephen-rettie
Copy link

stephen-rettie commented Oct 31, 2019

I was able to do question 5 on my local machine but on rhino the same code does nothing. I'm happy to post my answer if that's okay in this channel.

The manual for my local machine is like 1000X longer than the one on rhino. Maybe the version on rhino is old?

@k8hertweck
Copy link
Collaborator Author

@stephen-rettie We left out one small thing in the homework assignment, that is required to be able to use ImageMagick on rhino. You'll need to run the following code to load ImageMagick and make it available for use:

ml ImageMagick

After that, you should be able to complete the exercise as described. Thanks for catching this, and I'll update the question in the homework.

@k8hertweck
Copy link
Collaborator Author

Alright, it looks like the default version of parallel on rhino isn't compatible with question 5, but luckily, we can load an updated version:

ml parallel

I've updated the homework question accordingly.

@Amandakr713
Copy link

For question 1, after we've completed the tutorial, should our answer just include our thoughts about the tutorial and areas we found particularly challenging?

@matsen
Copy link
Contributor

matsen commented Nov 2, 2019 via email

@sbest0128
Copy link

For question 5, do we need to actually open a text editor, write our script and save the .txt file containing the script in our slides/images directory so that somebody can actually run that script?

@matsen
Copy link
Contributor

matsen commented Nov 3, 2019 via email

@alexgal8
Copy link

alexgal8 commented Nov 5, 2019

For question 3: I understand what tee does but I'm confused about where it goes and where the pipe operator goes. Here is what I have for question 1: ./tfcb_2019/lectures/lecture09/scripting/script2.sh 1> stdout.txt 2> stderr.txt
Where in here does tee and | go?

@alexgal8
Copy link

alexgal8 commented Nov 5, 2019

For question 4: After I get the words from anthony.txt listed one by one, how do I sort them? After googling, it sounds like I press v to select and then drag my cursor, but this doesn't work (when I click v it just types "v" and after that selecting by dragging cursor doesn't seem to work).

@matsen
Copy link
Contributor

matsen commented Nov 5, 2019 via email

@matsen
Copy link
Contributor

matsen commented Nov 5, 2019

For question 4: After I get the words from anthony.txt listed one by one, how do I sort them? After googling, it sounds like I press v to select and then drag my cursor, but this doesn't work (when I click v it just types "v" and after that selecting by dragging cursor doesn't seem to work).

It sounds like you're in vim. This question has to do with building a series of commands piped together in the shell.

@sbest0128
Copy link

So for question 5, I have saved wrote and saved a perfectly-working script (jpg-to-png_montage.sh) and is currently sitting on my Desktop. How am I able to take this script file and save it within the ~/tfcb_2019/lectures/lecture09/slides/images directory on the rhino server? Is this possible to do?

@sbest0128
Copy link

Nevermind my last question, I just created a new file within the ~/tfcb_2019/lectures/lecture09/slides/images directory on the rhino server using the cat > filename.sh function in which contains my script.

@alexgal8
Copy link

alexgal8 commented Nov 5, 2019

Where in here does tee and | go?
Play around and see what works!

I did for an hour and can't seem to find the right order to get both stderr and stdout to redirect to files while only getting stdout to display. Do you have any hints?

@alexgal8
Copy link

alexgal8 commented Nov 5, 2019

Where in here does tee and | go?
Play around and see what works!

I did for an hour and can't seem to find the right order to get both stderr and stdout to redirect to files while only getting stdout to display. Do you have any hints?

For question 4: After I get the words from anthony.txt listed one by one, how do I sort them? After googling, it sounds like I press v to select and then drag my cursor, but this doesn't work (when I click v it just types "v" and after that selecting by dragging cursor doesn't seem to work).

It sounds like you're in vim. This question has to do with building a series of commands piped together in the shell.

When I try sort tfcb_2019_lectures_lecture09_vim_anthony.txt | uniq
it says there is no such file or directory. Can you tell my why this is?

@matsen
Copy link
Contributor

matsen commented Nov 5, 2019

I did for an hour and can't seem to find the right order to get both stderr and stdout to redirect to files while only getting stdout to display. Do you have any hints?

Well, you want tee to be the only thing getting stdout. Note that the previous redirections you mentioned can go in any order.

When I try sort tfcb_2019_lectures_lecture09_vim_anthony.txt | uniq
it says there is no such file or directory. Can you tell my why this is?

Hm, that doesn't look like a unix path to me. Did you substitute the slashes with underscores? Note that you can check if a file exists by providing it as an argument to ls.

@alexgal8
Copy link

alexgal8 commented Nov 5, 2019

I did for an hour and can't seem to find the right order to get both stderr and stdout to redirect to files while only getting stdout to display. Do you have any hints?

Well, you want tee to be the only thing getting stdout. Note that the previous redirections you mentioned can go in any order.

When I try sort tfcb_2019_lectures_lecture09_vim_anthony.txt | uniq
it says there is no such file or directory. Can you tell my why this is?

Hm, that doesn't look like a unix path to me. Did you substitute the slashes with underscores? Note that you can check if a file exists by providing it as an argument to ls.

Ah yes thank you, I mixed up slashes and underscores. So when I enter
sort tfcb_2019/lectures/lecture09/vim/anthony.txt | uniq
I get the contents of anthony.txt but it is not sorted alphabetically with one word per line, which I thought was what sort did. Am I missing something? Thanks for your help!

@matsen
Copy link
Contributor

matsen commented Nov 5, 2019

I get the contents of anthony.txt but it is not sorted alphabetically with one word per line, which I thought was what sort did. Am I missing something? Thanks for your help!

Take another look at the question and at the documentation for sort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
homework questions about homework
Projects
None yet
Development

No branches or pull requests

7 participants