Sponsored Content
Top Forums Shell Programming and Scripting Send ctrl-C signal using bash script. Post 302965404 by BHASKAR JUPUDI on Thursday 28th of January 2016 01:14:30 PM
Old 01-28-2016
Send ctrl-C signal using bash script.

Code:
declare -a array=( "LLC-load-misses" "LLC-loads" "LLC-store-misses" "LLC-stores" "branch-load-misses" "branch-loads" "dTLB-load-misses" "dTLB-loads" "dTLB-store-misses" "dTLB-stores" "iTLB-load-misses" "iTLB-loads" "branch-instructions" "branch-misses" "bus-cycles" "cache-misses" "cache-references" "cpu-cycles" "instructions" "ref-cycles" "alignment-faults" "context-switches" "cpu-clock" "cpu-migrations" "emulation-faults" "major-faults" "minor-faults" "page-faults" "task-clock" )


arraylength=${#array[@]}
#echo $arraylength
# use for loop to read all values and indexes
for ((i=0; i<${arraylength}-25; i++))
do  
  var1="perf stat --log-fd 3 --repeat 10 -e "
  var2=${array[i]}
  var3=' filebench 3>resultsfilebench' 
  var4=$i
  var5='.log'
  varfinal=$var1$var2$var3$var4$var5
  eval $varfinal
done


When I try to run this script, it opens filebench application and waits for the user to press ctrl-C to iterate through the loop. I want this to be done automatically. perf command first enters the applications waits for the user to press ctrl-C and then print out the results. Is there any way to automate this by iterating through the loop without pressing ctrl-C?

Last edited by Don Cragun; 01-28-2016 at 03:39 PM.. Reason: Add CODE and ICODE tags.
 

10 More Discussions You Might Find Interesting

1. AIX

Disable ctrl-c,ctrl-d,ctrl-d in ksh script

I wrote a ksh script for Helpdesk. I need to know how to disable ctrl-c,ctrl-z,ctrl-d..... so that helpdesk would not be able to get to system prompt :confused: (6 Replies)
Discussion started by: wtofu
6 Replies

2. Shell Programming and Scripting

Ctrl-C signal propagation

Hello I have a master startup script (let's call it myScript) that displays a menu from which the user can start/stop several instances of a server. When I issue the start command for one of the servers from the menu and then exit myScript through the provided mechanism (enter "q" in this case),... (2 Replies)
Discussion started by: EvilBoz
2 Replies

3. Shell Programming and Scripting

How to send SIGNAL to the thread?

Hello, I have to send SIGSEGV to the thread. What is the simplest and efficient way to do that? (6 Replies)
Discussion started by: Rahulpict
6 Replies

4. Shell Programming and Scripting

How to send Ctrl Break combination in Expect

Greetings, I am writing an Expect script to automate multiple processes on an HP-UX system. Everything has gone fine so far but I now have run into a problem. One of the processes that I'm trying to automate requires the key combination of ctrl break and I have so far been unable to figure out... (1 Reply)
Discussion started by: g_trueblood2000
1 Replies

5. Shell Programming and Scripting

ctrl c trapping signal

im trying to make a trap signal 2 (ctrl c) in a bash script if a user presses ctrl c while running the script it should display an error message but not quit the bash script just yet. User will have to press "enter" to quit This is what i have so far #trap trap_control 2 #while true #do... (6 Replies)
Discussion started by: gangsta
6 Replies

6. Shell Programming and Scripting

ctrl-c in bash script - Programming

Hi All, I need to place a ctrl-c interrupt in a bash script, there is no other way, it has to be done :) can someone please advise how would I go about this? i want to use ctrl c in below code, after the code excution of just 1 min or 1sec java Cspsamp 111.19.5.172 7025 rd1... (6 Replies)
Discussion started by: aish11
6 Replies

7. Shell Programming and Scripting

How to handle CTRL+Z or CTRL+C in shells script?

Hi, while executing shell script, in the middle of the process, if we kill the shell script( ctrl+z or ctrl+c), script will be killed and the files which using for the script will be in the folder. How to handle those scenarios. Is there any possibilities, if user breaks the script, I need to... (3 Replies)
Discussion started by: ckchelladurai
3 Replies

8. AIX

Send ctrl+C in expect script

Hi, Am trying to transfer file via FTP using expect script from server to client i need to interrupt the file transfer between server and client Please help what should used in expect code.. I used send "ctrl+c\r" expect "Aborted" but that didnt work.. I need what should... (3 Replies)
Discussion started by: Priya Amaresh
3 Replies

9. Shell Programming and Scripting

Vi : Is it possible to send ctrl + d signal from a file made with vi and executing it.

Hi Experts, Is it possible to send ctrl + d signal from a inside a file made with vi, using Ctrl V , Esc and 004 , escape sequence. Since : 004 should exit the script if executed. Is this something possible. I am trying with vi , I put this code ^ , and trying to execute it but... (4 Replies)
Discussion started by: rveri
4 Replies

10. Shell Programming and Scripting

Expect command to send the user input enter or ctrl+c

Hey All, I am writing one script using expect, that script which is used in spawn will accepts only 1. Enter 2. Ctrl+c Press Control-C to exit, Enter to proceed. Could some one share some thoughts to send the above user inputs in linux expect block ? Thanks, Sam (0 Replies)
Discussion started by: SCHITIMA
0 Replies
NG_ATMLLC(4)						   BSD Kernel Interfaces Manual 					      NG_ATMLLC(4)

NAME
ng_atmllc -- ATM LLC netgraph node type SYNOPSIS
#include <netgraph/ng_atmllc.h> DESCRIPTION
The atmllc node type translates frames in to and out of ATM LLC encapsulation, as specified by RFC 1483. In LLC encapsulation the protocol of a given protocol data unit (PDU) is specified by an IEEE 802.2 LLC header, possibly followed by an IEEE 802.1a SubNetwork Attachment Point (SNAP) header. This node currently handles the Ethernet and FDDI protocols. The node transmits and receives ATM PDUs on the atm hook. Received PDUs are decoded and forwarded to the ether or fddi hooks as appropriate. Data received on the ether or fddi hooks are assumed to be full Ethernet or FDDI packets as appropriate and are encapsulated into a PDU and transmitted via the atm hook. HOOKS
This node type supports the following hooks: atm ATM connection. Typically, this hook would be connected to a ng_atm(4) node, which handles transmission of ATM PDUs over an ATM device. ether Ethernet connection. This hook sends and receives Ethernet frames. This would normally be connected to an ng_eiface(4) node if in use. fddi FDDI connection. This hook sends and receives FDDI frames. CONTROL MESSAGES
This node type supports the generic control messages. SHUTDOWN
This node shuts down upon receipt of a NGM_SHUTDOWN control message, or when all hooks have been disconnected. SEE ALSO
netgraph(4), ng_atm(4), ng_eiface(4), ngctl(8) J. Heinanen, Multiprotocol Encapsulation over ATM Adaptation Layer 5, RFC 1483. AUTHORS
Benno Rice <benno@FreeBSD.org> BSD
March 8, 2004 BSD
All times are GMT -4. The time now is 02:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy