Try echo -n >file instead. No newline.
touch file
Posted 17 February 2008 - 07:03 PM
Try echo -n >file instead. No newline.
touch file
Posted 17 February 2008 - 07:15 PM
Try echo -n >file instead. No newline.
touch file
>file
Edited by duper, 17 February 2008 - 07:16 PM.
Posted 17 April 2008 - 02:49 PM
root@nato [/]# cd /etc/ssl root@nato [/etc/ssl]# cd / root@nato [/]# cd - /etc/ssl root@nato [/etc/ssl]# cd - / root@nato [/]#
Posted 17 April 2008 - 08:46 PM
Okay... this may be a trick, because it's not in the manpage and I've not really seen it listed anywhere else.
To quickly move back and forth between two directories, you can use a single hyphen (-) after the "cd" command. Basically, it takes you back to the directory you were in immediately before the current one:root@nato [/]# cd /etc/ssl root@nato [/etc/ssl]# cd / root@nato [/]# cd - /etc/ssl root@nato [/etc/ssl]# cd - / root@nato [/]#
Posted 19 April 2008 - 10:24 AM
Okay... this may be a trick, because it's not in the manpage and I've not really seen it listed anywhere else.
To quickly move back and forth between two directories, you can use a single hyphen (-) after the "cd" command. Basically, it takes you back to the directory you were in immediately before the current one:root@nato [/]# cd /etc/ssl root@nato [/etc/ssl]# cd / root@nato [/]# cd - /etc/ssl root@nato [/etc/ssl]# cd - / root@nato [/]#
Posted 19 April 2008 - 04:41 PM
Edited by .solo, 19 April 2008 - 04:44 PM.
Posted 19 April 2008 - 04:47 PM
Posted 11 June 2008 - 10:14 PM
$ yum search LWP::Simple No Matches found $ yum search perl-LWP-Simple No Matches found
$ yum whatprovides 'perl(LWP::Simple)' perl-libwww-perl.noarch : A Perl interface to the World-Wide Web
Posted 07 July 2008 - 01:28 PM
$ curl urlthatdoesntexist.com curl: (6) Couldn't resolve host 'urlthatdoesntexist.com' $ echo $? 6
$ curl www.google.com > /dev/null % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 6538 0 6538 0 0 18957 0 --:--:-- --:--:-- --:--:-- 55232 $ echo $? 0
$ pwd /home/baphomet $ pushd / / ~ $ pwd / $ popd ~ $ pwd /home/baphomet
Edited by Baphomet, 07 July 2008 - 01:32 PM.
Posted 10 July 2008 - 10:00 PM
history | awk '{print $2}' | awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c | sort -n | tail | sort -nr
Posted 10 July 2008 - 10:55 PM
View most-used commands:
history | awk '{print $2}' | awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c | sort -n | tail | sort -nr
history | awk '{print $2}' | sort | uniq -c | sort -nr | head
Posted 24 July 2008 - 09:11 PM
localhost:~$ cat read.sh
#!/bin/bash
workingdir='/tmp/test'
cd $workingdir
array=(`ls`)
len=${#array[*]}
i=0
while [ $i -lt $len ]; do
echo "${array[$i]}" >> $HOME/output.txt
let i++
done
cat $HOME/output.txt | while read line; do
ls $workingdir/"${line}"/cur/* >> $HOME/result.txt #change this to ls $workingdir/"${line}"/cur/* | xargs rm -rf
donelocalhost:~$ ls /tmp/test/*/*
/tmp/test/1/cur:
file
/tmp/test/2/cur:
file
/tmp/test/3/cur:
file
/tmp/test/4/cur:
file
Posted 25 July 2008 - 12:36 AM
Posted 25 July 2008 - 05:55 PM
You just want to rm -Rf all files under $workingdir/"${line}"/cur/? That's a one liner, why is this a 20 liner?
Posted 25 July 2008 - 10:34 PM
You just want to rm -Rf all files under $workingdir/"${line}"/cur/? That's a one liner, why is this a 20 liner?
Because I was working with a directory structure that has about 500 email accounts. There are quite a few things left out of this script to avoid posting SQL scripts for a propriatery software company on a public forum.
The directory structure is like this: /var/mail/<customerid>/Maildir/cur
Where the customer id is pulled from a SQL database and inputted into my bash script that deletes the contents of the person(s) inbox. What decided the customer id in my case was inactive customers that had email disabled due to negligence of some type: spam, porn, large attachments, you name it.
Posted 12 October 2008 - 09:50 PM
Posted 13 October 2008 - 01:51 PM
#!/bin/sh
for i in `/sbin/ifconfig -a|grep 'inet addr'|awk -F":" '{print $2}'|awk '{print $1}'`;do host $i;done 2>/dev/nullPosted 23 April 2010 - 06:50 AM
Well with the interesting parts gutted, this script does essentially nothing. I'm just wondering why you posted it.You just want to rm -Rf all files under $workingdir/"${line}"/cur/? That's a one liner, why is this a 20 liner?
Because I was working with a directory structure that has about 500 email accounts. There are quite a few things left out of this script to avoid posting SQL scripts for a propriatery software company on a public forum.
The directory structure is like this: /var/mail/<customerid>/Maildir/cur
Where the customer id is pulled from a SQL database and inputted into my bash script that deletes the contents of the person(s) inbox. What decided the customer id in my case was inactive customers that had email disabled due to negligence of some type: spam, porn, large attachments, you name it.
find . -name '*' -print0 | xargs -0 rm
Posted 06 November 2010 - 03:49 PM
Posted 21 November 2010 - 08:37 PM
[n3xg3n@enigma ~]$ wgt http://www.whatismyip.org bash: wgt: command not found [n3xg3n@enigma ~]$ ^wgt^wget wget http://www.whatismyip.org --2010-11-21 20:35:48-- http://www.whatismyip.org/ Resolving www.whatismyip.org...
BinRev is hosted by the great people at Lunarpages!