How to create a simlink to a script (bash) file? (Solved)

Using applications, configuring, problems
Post Reply
Message
Author
martigej
Posts: 23
Joined: Thu 10 Jan 2013, 23:15

How to create a simlink to a script (bash) file? (Solved)

#1 Post by martigej »

Hi.
I'm running Puppy since some months.
Pupy is great to run in my old PC.
I have some programs that run fine under Wine.
I've created a script to run an exe file like this:

Code: Select all

#!/bin/sh
cd\
cd .wine
cd drive_c
cd PIC
wine regedit Setup.reg
wine start tinybldWin.exe
The exe file runs perfectly well. My problem is:
I would like to create a shortcut (or simlink?) in the desktop to run that script.
But I can't get this to run. No errors. Just "nothing" happens.

I'm looking for a response for days, but no success.
Can someone help?
Sorry if this is a stupid question.

Thanks.

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#2 Post by rufwoof »

cd \

will hang. In puppy (linux) you use a forward slash

cd /

I also suspect that's not what you actually want either as .wine I suspect is stored under your root directory

Try editing the file to


#!/bin/bash
cd /root/.wine/drive_c/PIC
wine regedit Setup.reg
wine start tinybldWin.exe

Then in rox-filer (file manager) right click the file and select the 'permissions' option from the list and select the make 'executable' choice. Then drag that icon from the rox-filer window onto the desktop and try clicking it from there (usually a single click - not the Windows style two clicks).

martigej
Posts: 23
Joined: Thu 10 Jan 2013, 23:15

#3 Post by martigej »

Hey ruf, thanks a lot!

I changed this:

Code: Select all

cd \ 
to this:

Code: Select all

cd / 
And all works fine!

If possible, I would like to know:
Why the back slash works in the script but not in the shortcut?

Thanks again.

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#4 Post by rufwoof »

Blind deer (no idea).

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

backslash in scripts

#5 Post by L18L »

martigej wrote:If possible, I would like to know:
Why the back slash works in the script but not in the shortcut?
Don't know for shortcut.
For script the back slash concats next line.
Example:

Code: Select all

do_this \
then that
is equivalent to

Code: Select all

do_this then that
Makes more sense with longer lines.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#6 Post by MochiMoppel »

martigej wrote:Why the back slash works in the script but not in the shortcut?
My guess: The backslash only *appears* to work. It produces an error, which - luckily - has no effect as the concatenated 2 lines were not needed anyway and with even more luck the rest of the script produces the results that you expect. This depends on where your script is stored and how it is started.

Most likely the script doesn't work as a shortcut because you didn't specify the directory from which to cd into the next level. Running the script by clicking on it in Rox will set the starting directory to the directory where the script is stored, running the script from a shortcut will set the directory most likely to the boot device (e.g. /mnt/sdb1), and lastly running the script from a console window will set the directory to /root. So without specifying an absolute path as in rufwoof's proposal your script will fail one way or the other.

If you like you can test this yourself:

Code: Select all

#!/bin/sh
CURRENT_DIR=$(pwd)
gxmessage Current directory: $CURRENT_DIR

Post Reply