Process call using Arduino Yun

Hi there,
I need to run a script file in my linux side through my arduino sketch code.
The file is located in /arduino/ping.sh and it runs through terminal by "/arduino/ping.sh" and works.
But using my sketch it doesn't. Its like I cannot run the script at all.

Please check my code. I am a rookie in linux so I dont know much about it.

/*
  Running process using Process class.

 This sketch demonstrate how to run linux processes
 using an Arduino Yún.

 created 5 Jun 2013
 by Cristian Maglie

 This example code is in the public domain.

 http://arduino.cc/en/Tutorial/Process

 */

#include <Process.h>

void setup() {
  // Initialize Bridge
  Bridge.begin();

  // Initialize Serial
  Serial.begin(9600);

  // Wait until a Serial Monitor is connected.
  while (!Serial);

  // run various example processes
  runCpuInfo();
}

void loop() {
  // Do nothing here.
}


void runCpuInfo() {
  // Launch "cat /proc/cpuinfo" command (shows info on Atheros CPU)
  // cat is a command line utility that shows the content of a file
  Process p;		// Create a process and call it "p"
  p.begin("/arduino/ping.sh");	// Process that launch the "cat" command
  //p.addParameter("/arduino/ping.sh"); // Add the cpuifo file path as parameter to cut
  p.run();		// Run the process and wait for its termination

  // Print command output on the Serial.
  // A process output can be read with the stream methods
  while (p.available() > 0) {
    char c = p.read();
    Serial.print(c);
  }
  // Ensure the last bit of data is sent.
  Serial.flush();
}

Post the contents of ping.sh! Some commands don't work the same if run in a terminal or without a controlling TTY.

#! /bin/sh
ping -c 1 google1.com > /dev/null 2>&1
status=$?
echo $status
if [ $status -eq "0" ]
then

if status = 0 then write 1 inside the file "connectivity" (overwrite)

echo "1" > connectivity
else
echo "0" > connectivity
fi

Something wrong with my code?

Where do you expect the connectivity file to be written? Always use full paths for such scripts. If that doesn't help, call "sh" and add your script's path as the first parameter to it.