unable to execute a .SH file


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users unable to execute a .SH file
# 8  
Old 07-30-2008
It's not clear from your problem description what the issue is. It would help if you could post the exact error message you are getting.

Some things to try:
  • Add a first line containing #!/bin/sh to the script
  • Add a second line containing the command which perl
  • Add a third line containing the command type perl

Post the output from the resulting script. Use code tags. Thanks.
# 9  
Old 08-05-2008
Quote:
In my file name Test.SH

I have only this command

Cp fileA.csv fileB.csv
perl -i.bak -0777 -ple's/(".*?)[\r\n]*(.*?")/$1$2/g' fileA.csv
So apart from the typo in the cp command name
I assume the above is the contents of file Test.SH
which you made executable (e.g. by chmod u+x Test.SH).
(Btw, why the extra copy of fileA.csv to fileB.csv beforehand?
Your Perl oneliner is called with the in-place-editing option -i
which will automatically dump a backup copy fileA.csv.bak for you)

But then you continue with
Quote:
Now I want to run this file

I did

./file.csv
which makes no sense to me at all.
Of course, does the shell complain that the file doesn't exist.
Wasn't it ./Test.SH you wanted to execute?
# 10  
Old 08-05-2008
no probs

Last edited by angelina; 08-11-2008 at 06:04 PM..
# 11  
Old 08-06-2008
If you could post the output of which perl and type perl and perhaps also locate perl those things might bring some clue.
# 12  
Old 08-06-2008
As already mentioned you should find the path to your Perl interpreter (perl):

Code:
type perl

Then make a script with the following content (change the path to the Perl interpreter if the previous command indicates a different one):

Code:
#! /usr/bin/perl -i.bak -0777 -p

s/(".*?)[\r\n]*(.*?")/$1$2/g;

Run the script like this:

Code:
./your_script filename

For example:

Code:
./fix_broken_lines fileA

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unable to execute glance from cronjob

Hi I am writing a script to get the CPU and memory utilization periodically from glance command. Wrote a script which consists of below two lines Script name : Utilization.sh #!/bin/sh glance -iterations 1 | sed -n '/Util/p/'| awk '!/Disk/'| awk '!/Swap/' >> file.txt I am able to run the... (5 Replies)
Discussion started by: Shravani
5 Replies

2. AIX

Unable to execute snap command

Hi Friends, I am not able to execute snap -a command in AIX 6 system. Could you please let me know how to make work this command and Path to be set. Thanks in Advance Siva. (4 Replies)
Discussion started by: sivakumarl
4 Replies

3. Solaris

Unable to execute any comman on a file

Hello everyone, I'm having a problem with a file. I can run any command on it : cp, mv, chmod,ln,more... Thanks for your help (13 Replies)
Discussion started by: adilyos
13 Replies

4. Shell Programming and Scripting

Unable to execute Stored Procedure from CRON

Hi, I am very new to this environment - I hope this is the right platform to discuss my issue: I created a CRON job to run a Stored Procedure from our database - Sybase. Within the Stored Procedure there is a TRUNCATE table and CREATE table function. the CRON job fails to run with... (2 Replies)
Discussion started by: pizzazzz
2 Replies

5. UNIX for Dummies Questions & Answers

Unable to execute the complete cmd - using find command

Hi, I'm unable to execute the below command completely ; it's not allowing me to type the complete command. It is allowing till "xargs" and i cannot even press enter after that. I'm using Solaris. Let me know if anything needs to be added so as to execute the complete command. Appreciate... (12 Replies)
Discussion started by: venkatesht
12 Replies

6. UNIX for Dummies Questions & Answers

unable to execute while loop

Hi everyone. I wanted to print numbers from 1 to 5 in reverse order. For this I used the following code: #!/bin/bash x=5 while do echo $x x=`expr $x - 1` echo "" done echo "" Well but on compiling the above code, it gives the following error. ... (3 Replies)
Discussion started by: grc
3 Replies

7. AIX

Unable to execute varyonvg during importvg

Hello, On Aix 5.3, during importvg, the varyonvg fails: importvg -y vgtest hdisk20 0516-013 varyonvg: The volume group cannot be varied on because there are no good copies of the descriptor area. When i use manually the command varyonvg -u -b -t vgtest to force, the vg can... (3 Replies)
Discussion started by: dantares
3 Replies

8. UNIX for Advanced & Expert Users

Unable to execute a function using trap

I have a script A which calls script B. I wrote a function in script A to be executed when Kill command is issued for script A and I invoke that function using the trap command.The function identifies all child process running under script A (in this case script B) and kills the child process and... (3 Replies)
Discussion started by: smohandass
3 Replies

9. Solaris

Unable to execute commands using rsh in Solaris 9 and 10.

Unable to execute commands using rsh in Solaris 9 and 10. When I execute this command " rsh -n 172.16.67.91 ls -l " I am getting this error message. ::ffff:172.16.67.91: Connection refused Please guide me how to enable rsh. Thanks & Regards Durgaprasad (1 Reply)
Discussion started by: durgaprasadr13
1 Replies

10. Shell Programming and Scripting

unable to execute background job

I am unable to execute the below command in background. Plz suggest. #> ./test input >out & 913618 + Stopped (SIGTTIN) ./test input >out & Suresh (1 Reply)
Discussion started by: suresh3566
1 Replies
Login or Register to Ask a Question