maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Shell one-liner challenge (https://talk.maemo.org/showthread.php?t=60781)

festivalnut 2010-08-21 15:41

Re: Shell one-liner challenge
 
apt-get moo

its not mine! but it rocks! :)

have you moo'ed today?

BlackDiamond 2010-08-21 15:59

Re: Shell one-liner challenge
 
Quote:

Originally Posted by dannym (Post 793955)
Actually, files whose names start with "." in the root directory of the filesystem tree will stay then.

No, *nix isn't windows and it doesn't know anything like "name.extension" the dot is simply part of the name with no difference from any letter so * actually means 'all the files'

shadowjk 2010-08-21 16:42

Re: Shell one-liner challenge
 
* is interpreted by the shell though. I guess what dannym meant was that it would leave out "hidden" files, or files starting with a dot.

lma 2010-08-21 16:46

Re: Shell one-liner challenge
 
Quote:

Originally Posted by BlackDiamond (Post 794089)
the dot is simply part of the name with no difference from any letter so * actually means 'all the files'

Nope, try "echo *" and "echo *.*" in $HOME for instance and/or see glob(7).

j.s 2010-08-21 18:07

Re: Shell one-liner challenge
 
Quote:

Originally Posted by timoph (Post 793752)
I'll start with something rather simple to get this going.

Code:

echo `head -2 < /proc/meminfo | awk '{print $2}' | sort -n` | awk '{printf("You have $1 kb of $2 kb free memory")}'

The above can be simplified even more by omitting the "<" after the "head -2", omitting the " | sort -n", and swapping $1 and $2.

(Of course, the $n must be replaced with %i, and listed after the output string, as mentioned by fnordianslip above.)

DrWilken 2010-08-21 18:26

Re: Shell one-liner challenge
 
Search for <phrase> in all files below <path> (Recursive):

Code:

grep -R <phrase> /<path>
I.e. search for files containing the word N900 in the MyDocs folder:
Code:

grep -R N900 /home/user/MyDocs
EDIT - Adding -i would do the same, only incase sensitive.

aligatro 2010-08-21 23:05

Re: Shell one-liner challenge
 
I wanted to write cat /dev/urandom > /dev/dsp ,but it doesn't work on n900 :(

on ubuntu, it sends random symbol to speakers and so you hear the "white noise"

giannoug 2010-08-21 23:33

Re: Shell one-liner challenge
 
Quote:

Originally Posted by aligatro (Post 794448)
I wanted to write cat /dev/urandom > /dev/dsp ,but it doesn't work on n900 :(

on ubuntu, it sends random symbol to speakers and so you hear the "white noise"

Hmm... /dev/dsp is the DSP and not the sound module, I think.

DrWilken 2010-08-21 23:34

Re: Shell one-liner challenge
 
Quote:

Originally Posted by giannoug (Post 794466)
Hmm... /dev/dsp is the DSP and not the sound module, I think.

Then doing it as root should give *some* kind of (visual) output... :D

BlackDiamond 2010-08-21 23:39

Re: Shell one-liner challenge
 
Quote:

Originally Posted by lma (Post 794139)
Nope, try "echo *" and "echo *.*" in $HOME for instance and/or see glob(7).

My bad! I misread what the man said. :p (And forgot about .* hidden files.)
Btw *.* won't catch files or directories without 'in middle' dot.


All times are GMT. The time now is 23:50.

vBulletin® Version 3.8.8