Re: Grrrrr .. Samba upgrade

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > > At this point I want to get rid of eveything samba and start over. Whats
> > > the best way to do that?
> > 
> > rpm -e $(rpm -qa 'samba-*')
> > 
> > Then install a new samba which was built for your platform.
> > 

On Fri, 2003-10-17 at 23:34, mysql@xxxxxxxxx wrote:
> Thanks for the reply!!
> 
> The rpm -e and the 'samba-*' I understand, but where does the $(rpm -qa
> 'samba-*') come from?
> I ask this only because I really want to learn Linux - if I had stuck
> with it 2 years ago, I would not have to ask now ...
> 

it is called command substitution.  in bash there are two ways to
achieve it.  the old way is to use backticks `command` and the better
way imnsho is using $(command) this way you can nest commands.

what happens is that when the command line is parsed by bash the stuff
in $( ) gets executed and the output of the command gets subsituted in
its place hence the name.  So, in this case the output of the command
rpm -qa 'samba-*' gets added as arguments to the rpm -e command and of
course causes rpm to try and erase all the packages that begin with
samba-.

This is way cool and allows all sorts of intricate stuff to be
accomplished in oneliners.

man bash is a tremendously dense document that I read at least parts of
over and over again to add tools to my programming tool box. I have read
it beginning to end several times and at least now I sort of remember
that there was something in there and can usually search for terms and
find the solution fairly quickly.  Tonights example was wanting to find
out if the file name I had in a variable contained either mpg or mpeg
the solution I found was that be setting the extglob on using shopt -s
extglob I could do if ( [[ $myvar == *mp?(e)g ]] );then blah blah  I
started my search using /string a bunch of n's and I found the term
pattern matching and off I went.

if you are not good at using man pages  man man and man less are good
reads especially man less.  less is definitely more :)

bash is truly amazing. Read the man page an glean as much as you can and
then read it again in a month after dinking with it some and see if
there aren't more nuggets to be found each time you reread it.


HTH

Bret


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux