LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-02-2014, 01:12 PM   #16
lwv962
Member
 
Registered: Feb 2011
Location: Wales
Distribution: MX Linux 18
Posts: 36

Original Poster
Rep: Reputation: 0

Quote:
In your .bashrc, in cadno function try to write the full path to radiotray just in case.

eg
Code:

cadno () {

/usr/bin/radiotray url goes here
}
Nothing happening !
 
Old 09-02-2014, 01:19 PM   #17
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
I see one problem right here:
Code:
peter@peter-Lenovo-G580 ~ $ at now + 1 minute
warning: commands will be executed using /bin/sh
at> cd ~/rhag
...
Your tilde path, ~/rhag, is not going to be recognized by /bin/sh. /bin/bash knows how to handle a tilde, so does /bin/ksh (if that's installed on your system), but /bin/sh does not understand the tilde. Thus your cd will not work under /bin/sh, and /bin/sh is what "at" uses - says so right there when you invoke it. Skip the tilde and specify your path as /home/rhag (or whatever the correct path to your $HOME directory is).

Do not assume that /bin/sh points to /bin/bash. On my system it does not:
Code:
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Mar 11  2013 /bin/sh -> dash
$ ls -l /bin/dash
-rwxr-xr-x 1 root root 109768 Mar 29  2012 /bin/dash
$ ls -l /bin/bash
-rwxr-xr-x 1 root root 959120 Mar 28  2013 /bin/bash
$
 
Old 09-02-2014, 01:23 PM   #18
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Quote:
Only one thing puzzles me how would one activate a function that was in ~/bashrc ,~/bash_aliases or in a script ?
Remember, "at" is using /bin/sh, not /bin/bash. So /bin/sh is not going to understand those tildes, nor would it ever think to look in bashrc, etc. even if it did understand the tildes ... since it's not bash, it's sh.
 
Old 09-02-2014, 01:41 PM   #19
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Quote:
Originally Posted by haertig View Post

Do not assume that /bin/sh points to /bin/bash. On my system it does not:
Good point, I didn't think of that

lwv962, instead of source .bashrc, use . (dot)

Code:
. /home/peter/.bashrc
 
Old 09-03-2014, 05:56 AM   #20
lwv962
Member
 
Registered: Feb 2011
Location: Wales
Distribution: MX Linux 18
Posts: 36

Original Poster
Rep: Reputation: 0
Whew !

This does work :

Code:
peter@peter-Lenovo-G580 ~ $ at now + 2  minutes 
warning: commands will be executed using /bin/sh
at> export DISPLAY=:0.0
at> . /home/peter/.bashrc
at> cadno
at> <EOT>
job 354 at Wed Sep  3 08:06:00 2014
I was so tired yesterday I was making all sorts of mistakes.

But I'm trying to get a one liner,this very crude script sort of works
BUT it runs without ANY DELAY WHATSOEVER

Code:
#!/bin/bash 

read -p "Enter time:" amser
at $amser
export DISPLAY=:0.0
. /home/peter/.bashrc
cadno
~                                                                               
~                                                                              
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                              d 
"atscript.sh" 7L, 100C                                        5,1           All
I would say my question is solved ; keefaz and haertig many thanks for patience and excellent help.
I hope by declaring this as solved it would still remain open ,for there are quite a few aspects of
this command that need to be explored ,as the Man Page is not very detailed.
 
Old 09-03-2014, 08:16 AM   #21
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Quote:
Originally Posted by lwv962 View Post
BUT it runs without ANY DELAY WHATSOEVER
Your script doesn't pass the commands that follows at line to at...

What it does is run "at" at specified time with no command, and execute commands following at lines

try:
Code:
#!/bin/bash 

read -p "Enter time:" amser
at $amser <<END
export DISPLAY=:0.0
. /home/peter/.bashrc
cadno
END
 
1 members found this post helpful.
Old 09-03-2014, 09:07 AM   #22
lwv962
Member
 
Registered: Feb 2011
Location: Wales
Distribution: MX Linux 18
Posts: 36

Original Poster
Rep: Reputation: 0
Thanks keefaz ,

I messed that one !! Btw I've found this works without functions:


Code:
#!/bin/bash
 
r4= /usr/bin/radiotray http://.......

insp= /usr/bin/radiotray url or whatever the link is

they can be called from the CLI. as one did with the function.

BUT your sanitised version of my script allied with that list

file makes the use of a function unnecessary.

I don't what you think but "A HOW TO " on 'at" would be handy !?
 
  


Reply


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
command "tree" can't display output correctly in xemacs shell philip518 Linux - Newbie 4 05-24-2012 12:48 PM
"ip route flush table main" doesn't work correctly from rc.local? gleemer Linux - Networking 0 08-17-2011 05:03 PM
pwmconfig correctly detects fans but "test" doesn't work...? shock_ez Linux - Software 0 05-07-2009 10:35 AM
Syslinux doesn't correctly interpret kernel="/foo/bar" command lumix Linux - Newbie 4 06-19-2008 12:15 PM
How to use "useradd" command correctly? hus Linux - Newbie 3 05-12-2004 01:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:55 AM.

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