Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 01-25-2007, 06:21 AM   #1
Dark Carnival
Registered: Jun 2003
Posts: 166

Rep: Reputation: 30 syntax (help please)

I'm currently adding packages to my slackware install cd's and I've finally come to a point where I do need to write a script to sort a few things out after the installation..

I need the packages to install and word inside the slackware installer.. so I suppose they should be ash-compatible.

I've seen a few scripts inside packages such as:
( cd /path/to/program; ln -s link sourcefile )
( cd /path/to/program; ln -s link2 sourcefile2 )

Now.. that hardly look like my average bash script..

Is it not possible for me to just omit parenthesises and handle the same action like so:

cd /path/to/program
ln -s link sourcefile
ln -s link2 sourcefile2

And can't I just use if-blocks, for-loops and so on like I usually do with bash scripts ?

The reason I ask is because the tutorial on show regular sh syntax but the scripts I've seen in files so far show the other syntax...

Please help
Old 01-25-2007, 07:24 AM   #2
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 30
The effect of the parentheses is to fire off a subshell to do the work within those parentheses, and then come back to your original shell.

In the example you cite, this aspect is important. When you come back to the main shell, your current directory is as it was before you did the work. Try this at your shell prompt:

(cd /; pwd)
cd ;/ pwd

.. and you'll see what the parentheses buy for you.
Old 01-25-2007, 07:49 AM   #3
Alien Bob
Slackware Contributor
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 5,789

Rep: Reputation: Disabled
The is just a shell script. You have to take into account though that when you have a package on the install CD, the shell it runs in is not bash but the less powerful "ash" (which does not have all of the functionality of the bigger bash). So you should check your script against the ash manual perhaps.
Most standard shell scripting commands will be handled properly by ash, so I expect no real problems here.

An important thing to know is that you should not use absolute paths in the script. That is why you'll see lines like
config etc/rc.d/
instead of
config /etc/rc.d/
. The reason is that you can instruct installpkg to install a package somewhere else than to "/" (your root filesystem), and that is exactly how the install CD works (the partition that Slackware is being installed to is mounted somewhere under /var IIRC).

Old 01-25-2007, 09:08 AM   #4
Dark Carnival
Registered: Jun 2003
Posts: 166

Original Poster
Rep: Reputation: 30
Thanks a lot to both of you

I'll keep both things in mind and hopefully my packages won't blow up during installation or anything


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post i need to install packages using command line Clarence27 Zenwalk 2 10-07-2006 07:03 AM
C syntax ashlesha Programming 6 07-04-2006 07:53 PM
appending to perllocal.pod via jong357 Slackware 1 10-31-2005 10:48 AM
C++ syntax error before :: token HELP, i cant find the syntax error :( qwijibow Programming 2 12-14-2004 06:09 PM
C syntax help please ... DarkDrive Programming 2 08-07-2003 04:13 PM

All times are GMT -5. The time now is 04:50 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration