LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Script help (https://www.linuxquestions.org/questions/linux-newbie-8/script-help-574941/)

noonmid27 08-05-2007 07:31 PM

Script help
 
Hi guys

ok i created this little installation script, which will make it easier for me to installpkgs on slackware 12.0. one of the lines in my script goes like this explodepkg packagename.gz |grep 'configure' | find -P -type f -name configure -exec configure. the output i get from this line is missing argument to 'exec'. how can i make the find command execute the configure file. even when i use ./configure i get the same result.

jschiwal 08-05-2007 07:58 PM

Quote:

packagename.gz |grep 'configure' | find -P -type f -name configure -exec configure
There are a couple problems with this oneliner. Piping the output of grep to find doesn't make sense. Also when you are outside the package directory find may return configure from other directories as well.

Something like
explodepkg ${1} && cd "${1%.tar.gz}" && ./configure
might work better.

Even this isn't a good idea. It's always best to read the README and INSTALL files, and look at "./configure --help" first. There may be options that you want or need.

noonmid27 08-06-2007 09:10 AM

can you explain to me what the explodepkg ${1} && cd "${1%.tar.gz}" && ./configure means. i dont know what all the symbols mean. thx.

muha 08-06-2007 10:01 AM

An excellent guide on these basic shell features:
http://www.linuxcommand.org/wss0130.php
http://www.linuxcommand.org/wss0150.php

Also:
http://tldp.org/LDP/abs/html/paramet...stitution.html
Quote:

${var%Pattern}
Remove from $var the shortest part of $Pattern that matches the back end of $var.

jschiwal 08-08-2007 06:24 PM

If you have a script, lets say, ~/bin/expl, and you include an argument of the package file, lets say abc-utils-1.1.tar.gz, then in the script, "${1}" is the first argument. It has the value of "abc-utils-1.1.tar.gz". "${1%.tar.gz}" strips of the .tar.gz extensions, leaving "abc-utils-1.1". Most packages when extracted will be contained in a directory by the same name of the package.

I don't use Slackware, so I'm not familiar with the explodepkg program and how it differs from untar'ing a package. But you can run it on its own and see what the new directory is named. It probably follows the same convention.


All times are GMT -5. The time now is 12:50 AM.