Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-27-2017, 05:15 AM   #1
Registered: Feb 2017
Posts: 38

Rep: Reputation: Disabled
Unable to execute .sh script

Hi There

I am trying to execute a .sh script, however when I go to submit I get the following response:
./ line 1: /opt/ca/APM/Introscope10.2.0.27/logs/IntroscopeWebView.log: Permission denied
I am able to get in that directory quite easily using cd as shown below:

[rp1cem@wycvlapph036 logs]$ pwd
[rp1cem@wycvlapph036 logs]$
The directory I am able to run as well:
-rw-r--r--. 1 root root 81393779 Mar 27 10:12 IntroscopeWebView.log
Any particular reason why this isn't executing. I have provided an example of my code below:

users_connected=`/opt/ca/APM/Introscope10.2.0.27/logs/IntroscopeWebView.log | awk '{name[$11]++} END {for (i in name) print i,name[i]}' | sort -n -k 2`

echo $user_connected
Many thanks for your help in advance
Old 03-27-2017, 05:32 AM   #2
Senior Member
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 4,463
Blog Entries: 3

Rep: Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230
Yes, you cannot execute the log file. It is text data and not a program so it will fail. So you must tell awk to read the log file:

users_connected=$(awk '{name[$11]++} END {for (i in name) print i,name[i]}' /opt/ca/APM/Introscope10.2.0.27/logs/IntroscopeWebView.log | sort -k2,2n -k1,1);

Last edited by Turbocapitalist; 03-27-2017 at 05:40 AM. Reason: sort
1 members found this post helpful.
Old 03-27-2017, 05:44 AM   #3
Registered: Feb 2017
Posts: 38

Original Poster
Rep: Reputation: Disabled
Thanks Turbocapitalist thats fixed the issue Also thanks for explaining to me the problem


newbie, permission denied, scripting, shell script, unix

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
Unable to execute file (I have execute permission) leoecco Linux - General 1 07-20-2013 11:20 PM
Unable to execute "reboot" in cgi script jcaga Fedora 4 05-10-2012 09:45 AM
unable to execute shell scritp from php script kamlesh_kmr Programming 2 10-17-2011 01:43 AM
[SOLVED] [Ubuntu] apt libxml-sax-perl "unable to execute installed post-installation script" XXLRay Linux - Software 1 07-17-2010 10:20 AM
How to execute a ssh script on Linux server from Windows through a bat script? wanna13e Programming 13 10-23-2009 03:41 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:41 PM.

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