![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Unverified User
Join Date: Aug 2005
Location: none
Posts: 146
Rep Power: 0
![]() |
Problem with aliasing
I'm using kdialog a lot in a Bash script, and I always use the option --title="$title". So I made an alias, alias kdialog="kdialog --title=\"$title\"". The line alias|grep kdialog in the script outputs alias kdialog='kdialog --title="Audio Konvert 0.3.0"', but the title of a dialog created with kdialog --yesno "test" has a title of "Question - KDialog."
I'm trying to keep this all in one script.
__________________
Warning: My posts may change (dramatically) within the first 15 minutes they're posted. Got 'Nux?—GNU/Linux and other free software support. It's GNU/Linux, not just Linux. |
|
|
|
|
|
#2 |
|
Unverified User
Join Date: Aug 2005
Location: none
Posts: 146
Rep Power: 0
![]() |
Anyone?
__________________
Warning: My posts may change (dramatically) within the first 15 minutes they're posted. Got 'Nux?—GNU/Linux and other free software support. It's GNU/Linux, not just Linux. |
|
|
|
|
|
#3 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4
![]() |
Funny; it works for me. What version of KDE are you using?
|
|
|
|
|
|
#4 |
|
Unverified User
Join Date: Aug 2005
Location: none
Posts: 146
Rep Power: 0
![]() |
notroot[0:~]& rpm -q kdebase
kdebase-3.5.0-0.1.fc4 notroot[0:~]& Mabe it's something wrong with somethinge else in the script...? Should I attach it (It's 37KB)?
__________________
Warning: My posts may change (dramatically) within the first 15 minutes they're posted. Got 'Nux?—GNU/Linux and other free software support. It's GNU/Linux, not just Linux. |
|
|
|
|
|
#5 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4
![]() |
Same KDE version I have, so it's nothing to do with 3.5. Have you tried doing this normally?
title="Audio Konvert 0.3.0" alias kdialog="kdialog --title=\"$title\"" kdialog --yesno "Testing, 1, 2, 3." |
|
|
|
|
|
#6 |
|
Unverified User
Join Date: Aug 2005
Location: none
Posts: 146
Rep Power: 0
![]() |
Now try putting that in a shell script.
__________________
Warning: My posts may change (dramatically) within the first 15 minutes they're posted. Got 'Nux?—GNU/Linux and other free software support. It's GNU/Linux, not just Linux. |
|
|
|
|
|
#7 | |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4
![]() |
Quote:
Perhaps use a function instead? function kdialog
{
/usr/bin/kdialog --title="$title" $*
}Functions will only be around for the duration of the script, I believe (unless you put them in bashrc or similar), but they are called the same way you would call a regular command or alias: kdialog --yesno "Testing, 1, 2, 3." |
|
|
|
|
|
|
#8 |
|
Hobbyist Programmer
Join Date: Aug 2005
Posts: 137
Rep Power: 3
![]() |
Aliases are disabled for non-interactive shells (shell scripts) according to my book so I guess your experiment confirms it.
|
|
|
|
|
|
#9 |
|
Unverified User
Join Date: Aug 2005
Location: none
Posts: 146
Rep Power: 0
![]() |
Good idea Arevos
![]() #!/bin/bash
title="This is a test."
kdialog ()
{
`kde-config --prefix`/bin/kdialog --title="$title $* #or $@
}
kdialog --yesno "Testing, 1, 2, 3."almost works. The title works, but the content is "Testing," and excludes " 1, 2, 3."
__________________
Warning: My posts may change (dramatically) within the first 15 minutes they're posted. Got 'Nux?—GNU/Linux and other free software support. It's GNU/Linux, not just Linux. |
|
|
|
|
|
#10 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4
![]() |
`kde-config --prefix`/bin/kdialog --title="$title $* #or $@ |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|