Help with ksh Script not resolving '@' in ls command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with ksh Script not resolving '@' in ls command
# 8  
Old 02-05-2015
Sometimes reading the title on top of the post contents proves to be helpful...
# 9  
Old 02-05-2015
Hi Scrutinizer
We are using Linux / KSH93.
The script is invoked during a batch job. The batch ID has ksh as the default and the start of the script also has #!/usr/bin/ksh -x
Cheers
# 10  
Old 02-05-2015
But how precisely is the script called by the batch ID?
Do you also set the FileDir and triggers variables on the command line?
Have you checked whether there are any files in that particular directory, as others have suggested?
Also try using:
Code:
ls "$FileDir/dir/subdir/"${triggers}

# 11  
Old 02-06-2015
Cheers Scrutinizer that did help. With the doubel quotes it did manage to expand out the three different filename qualifiers. Trouble is now it says 'name too long' !
I think I'll just split this into three seperate commands and cat them together.
Cheers for help
# 12  
Old 02-07-2015
Hi Grueben, Instead of
Code:
ls "$FileDir/dir/subdir/"${triggers}

You could try:
Code:
exists() {
  [ -e "$1" ]
}

if exists "$FileDir/dir/subdir/"${triggers}; then
  printf "%s\n" "$FileDir/dir/subdir/"${triggers}
fi


Last edited by Scrutinizer; 02-08-2015 at 07:59 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh script find command not printing any results

Hello, Hitting a wall on this one. When at the command prompt it works fine: # find /home/testuser -name 'PAINT*canvasON.txt' /home/testuser/PAINT_canvasON.txt # pwd /home/testuser # ls -l PAINT*canvasON.txt -rw-r--r-- 1 root user 23 Feb 07 02:58 PAINT_canvasON.txt... (2 Replies)
Discussion started by: seekryts15
2 Replies

2. Shell Programming and Scripting

Help with command in ksh script

I want my script to check directories and files within the directories older than 7days lold and remove them but the script only removes the directories older than 7 days. find home/prod/clt/nal/inb -mtime +7 -exec rm -rf {} \; The inb contains multiple directories that contain... (2 Replies)
Discussion started by: Bperl1967
2 Replies

3. Shell Programming and Scripting

KSH Script to Execute command from specific column in file

Hi Unix Experts,Team I have a file (say comand_file.prm), The file has a command specified in column 6 (say "./execute_script.sh"). I want to execute this command in my script. I am writing a KSH script to achieve this. Could you please assist me with this. (6 Replies)
Discussion started by: Jeevanm
6 Replies

4. Shell Programming and Scripting

AIX .ksh script freezes when using the mail -s command

Hello I am trying to send an email when a .KSH script is run on an AIX Machine. This email will only include a subject line that is made up of variables from within the script, and is as follows: CURRENT_DATE=`date +%Y%m%d` TIME=`date` ADMIN="myname@domain.com" date block () { ... (4 Replies)
Discussion started by: jimbojames
4 Replies

5. UNIX for Advanced & Expert Users

Running ksh script from command line

Hi. I have a ksh script I want to run, but I'm connecting through a telnet and I don't want to FTP the scripts itself. is there a way of running the script from command line ? like ksh "The script itself..." Thanks, Ramon (4 Replies)
Discussion started by: mellowcandle
4 Replies

6. Shell Programming and Scripting

problem with KSH script: command line args

Hi I am executing a KSH script by passing command line arguments example: Red Green Dark Red Blue when I am splitting the arguments by using " "(Space) as delimiter But the colour Dark Red is a single parameter. But it is getting splitted in between How to avoid this. Please help Also... (4 Replies)
Discussion started by: hemanth424
4 Replies

7. Shell Programming and Scripting

KSH script: piping passes command-line arguments

Dear forum I have the following small script: #!/bin/ksh echo -e "abba-o" | awk -F '-' '{ print $2 }' | cut -b 1It needs to be ksh.. in bash I don't have this problem. If I run this on opensuse 10.2 I get this as output: e If I run this on suse enterprise 10 sp2 then I get this: o ... (1 Reply)
Discussion started by: gemtry
1 Replies

8. Shell Programming and Scripting

ssh command in ksh script encounters permission error

I've created a script and copied it to another server and try to execute it at the same time but I'm getting a permission error. I'm logged on as root and I gave the file 777 permission when I created it, but I can't run it remotely via ssh command because of permission issue. Any ideas? ... (5 Replies)
Discussion started by: pdtak
5 Replies

9. Shell Programming and Scripting

Command taken away from ksh script

Hi, Any help or suggestions would be most appreciated. I am having problems in the latter end of this ksh script where I will be checking two files. If they exist do nothing otherwise I need to reinitialize the database which resides on o/s Aix 5.3. The problem I am facing is when the reinit... (2 Replies)
Discussion started by: hgjdv
2 Replies

10. Shell Programming and Scripting

#!/usr/bin/ksh Command Interpreter in a sh script

Hi, I have a developer that is trying to start a script with sh "scriptname". In the script, he is specifying #!/usr/bin/ksh as the command interpreter. For some reason sh is ignoring the #!/usr/bin/ksh. We are running Solaris 8. Does anyone have any ideas what could be causing this? Here... (3 Replies)
Discussion started by: ckeith79
3 Replies
Login or Register to Ask a Question