Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I tried to use at from within a script of mine and it prints:

warning: commands will be executed using /bin/sh

How would I use different shell if I wanted?

share|improve this question

2 Answers 2

you can achieve running it from a different shell changing the script shebang. Some typical shebang lines:

#!/bin/sh — Execute the file using sh, the Bourne shell, or a compatible shell
#!/bin/csh -f — Execute the file using csh, the C shell,
#!/usr/bin/perl -T — Execute using Perl with the option for taint checks
#!/usr/bin/php — Execute the file using the PHP command line interpreter
#!/usr/bin/python -O — Execute using Python with optimizations to code
#!/usr/bin/ruby — Execute using Ruby

To run a script at given times I suggest you adding a cronjob

Example:

The following line makes the user program test.pl—ostensibly a Perl script—run every two hours, at midnight, 2am, 4am, 6am, 8am, and so on:

0 */2 * * * /home/username/test.pl

share|improve this answer
    
#!/usr/bin/perl is already the shebang in my script but I get the warning –  Cratylus Aug 8 '13 at 21:06
    
@Cratylus take a look here for explanation. –  vfbsilva Aug 8 '13 at 21:08
    
+1 shbang and mention of ruby and perl. Also, consider using "#!/bin/env ruby". –  ChuckCottrill Oct 28 '13 at 22:46

Under Linux, at always warns you that it will execute the specified commands with /bin/sh, rather than your favorite shell. You cannot suppress this message, it's hard-coded in the source code.

The command you pass is interpreted by /bin/sh. This command can be the path to a script if you like; then /bin/sh will execute the script program, causing the script's interpreter to be launched and to interpret the script. The language of the script is completely independent of the program that starts it. So if for example you want to execute a bash script (i.e. a script that begins with #!/bin/bash), just pass the path to the script to at and ignore the irrelevant message.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.