Command Line - Redirection Lesson 2. - Interface doesn't accept the ">" sign even when I type it


#1

In the Redirection Lesson of the Command Line Course the instructions says: "In the terminal, type echo "Hello" > hello.txt, however when I try, the interface doesn't accept my greater than sign (>) from my keyboard and it results in this:

$ echo "Hello" hello.txt                                                              
Hello hello.txt                                                                       
$

Since it thinks I haven't completed the instructions I can't move forward. Any ideas on how I should proceed? I already have sent a report bug but I don't know what else to do. Please help!

Thanks a lot!

Camille


#2

Help from this post: https://discuss.codecademy.com/t/my-keyboard-does-not-allow-me-to-type-a-character-used-in-a-codecademy-lesson-what-should-i-do/29228

However even when I use OPTION 3, the greater than sign (>) doesn't show up on the interface. Anyone has an idea?


#3

Pasting it in? Changing browser?

Otherwise you can probably write a script that adds it to your .bash_history, then reload history from file and press UP
Completely ridiculous work-around but hey..

$ python -c "open('$HOME/.bash_history', 'a').write(chr(62) + '\n')"
$ history -r

less-than is has an ascii value of 60 if you need that as well


#4

I tried pasting it and changing browser, it didn't work.
I will try the solution you're offering soon, just need to figure out how since it's way more advanced than where I am right now with coding haha. But thanks a lot for taking the time and for the tip!


#5

You'd just copy those two lines into bash ($ at the start is to say it's to be entered into bash)
You don't really need to know anything to do that.

Another way of going about it is to upload a text file with those characters, download it and replace your history file.

For example I made one here: https://paste.debian.net/plain/781637

To download it and overwrite your .bash_history:

$ wget https://paste.debian.net/plain/781637
$ mv 781637 ~/.bash_history
$ history -r

Appending to your history would be preferable but >> is used to do that.. There's probably a way around that too but your history is probably not of any value anyway.


#6

Hi thanks a lot for your tips. I was away for a couple of days which is why I only answer now.

So I tried writing the script to type > into bash and here is what the output was:

    -r, --remotes         act on re         mote-tracking branches                          --contains <commit>   print onl         y branches that contain the commit              --abbrev[=<n>]        use <n> d         igits to display SHA-1s                                                                 Specific git-branch actions:                    -a, --all             list both          remote-tracking and local branches             -d, --delete          delete fu         lly merged branch                               -D                    delete br         anch (even if not merged)                       -m, --move            move/rena         me a branch and its reflog                      -M                    move/rena         me a branch, even if target exists              --list                list bran         ch names                                        -l, --create-reflog   create th         e branch's reflog                               --edit-description    edit the          description for the branch                      -f, --force           force cre         ation (when already exists)                     --no-merged <commit>  print onl         y not merged branches                           --merged <commit>     print onl

This was in the Learn Git lesson, and I encountered the same issue as in the command line.


#7

Okay I finally understand what you meant by adding it to the .bash_history. Although I had fully everything single character because the bash doesn't let me paste anything in it, now when I press UP I have both < and > signs stored. THANKS SO MUCH. I was ready to pull my hair out.
I have to say though that it is indeed completely ridiculous to go to such length to be able to type a single character into the interface, something definitely needs to be done.

Anyway thanks a lot man!


#8

New update: turns out my keyboard was in Canadian French mode (I got my laptop in Montreal), just changed it to US and amazingly all the characters worked as I typed them. Sigh.


#9

The irony now is that with the US keyboard it doesn't let me type the " " so what I end up doing is to go back and forth between the US and Canadian keyboards.


#10

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.