Sponsored Content
Top Forums UNIX for Beginners Questions & Answers C shell concatenate string doesn't work Post 303042750 by blackrageous on Sunday 5th of January 2020 09:33:03 PM
Old 01-05-2020
This code seems to run ok...here's the output I get when run on my Linux system..

Code:
current wavelength is: 0.7
current radius is: 1.0
current lwp is: 39.999
pp_LWP_39.999_Re_1.0_wav_0.7.prp
current lwp is: 80.001
pp_LWP_80.001_Re_1.0_wav_0.7.prp
current lwp is: 120.0
pp_LWP_120.0_Re_1.0_wav_0.7.prp
current lwp is: 159.999
pp_LWP_159.999_Re_1.0_wav_0.7.prp
current lwp is: 200.001
pp_LWP_200.001_Re_1.0_wav_0.7.prp
current lwp is: 240.0
pp_LWP_240.0_Re_1.0_wav_0.7.prp
current lwp is: 279.999
pp_LWP_279.999_Re_1.0_wav_0.7.prp
current radius is: 2.0
current lwp is: 39.999
pp_LWP_39.999_Re_2.0_wav_0.7.prp
current lwp is: 80.001
pp_LWP_80.001_Re_2.0_wav_0.7.prp
current lwp is: 120.0
pp_LWP_120.0_Re_2.0_wav_0.7.prp
current lwp is: 159.999
pp_LWP_159.999_Re_2.0_wav_0.7.prp
current lwp is: 200.001
pp_LWP_200.001_Re_2.0_wav_0.7.prp
current lwp is: 240.0
pp_LWP_240.0_Re_2.0_wav_0.7.prp
current lwp is: 279.999
pp_LWP_279.999_Re_2.0_wav_0.7.prp
current wavelength is: 1.61
current radius is: 1.0
current lwp is: 39.999
pp_LWP_39.999_Re_1.0_wav_1.61.prp
current lwp is: 80.001
pp_LWP_80.001_Re_1.0_wav_1.61.prp
current lwp is: 120.0
pp_LWP_120.0_Re_1.0_wav_1.61.prp
current lwp is: 159.999
pp_LWP_159.999_Re_1.0_wav_1.61.prp
current lwp is: 200.001
pp_LWP_200.001_Re_1.0_wav_1.61.prp
current lwp is: 240.0
pp_LWP_240.0_Re_1.0_wav_1.61.prp
current lwp is: 279.999
pp_LWP_279.999_Re_1.0_wav_1.61.prp
current radius is: 2.0
current lwp is: 39.999
pp_LWP_39.999_Re_2.0_wav_1.61.prp
current lwp is: 80.001
pp_LWP_80.001_Re_2.0_wav_1.61.prp
current lwp is: 120.0
pp_LWP_120.0_Re_2.0_wav_1.61.prp
current lwp is: 159.999
pp_LWP_159.999_Re_2.0_wav_1.61.prp
current lwp is: 200.001
pp_LWP_200.001_Re_2.0_wav_1.61.prp
current lwp is: 240.0
pp_LWP_240.0_Re_2.0_wav_1.61.prp
current lwp is: 279.999
pp_LWP_279.999_Re_2.0_wav_1.61.prp

This User Gave Thanks to blackrageous For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep doesn't work within shell script?

I am trying to run the following code from a script file but it complains that syntax of (both instances of) grep is wrong. When I copy and paste it to the terminal, it is OK. Any idea what the problem might be? set i = `grep -c #define flags.h` while ($i>20) @ i-- my func (`cat... (4 Replies)
Discussion started by: barisgultekin
4 Replies

2. Shell Programming and Scripting

How to concatenate two strings or several strings into one string in B-shell?

like connect "summer" and "winter" to "summerwinter"? Can anybody help me? thanks a lot. (2 Replies)
Discussion started by: fontana
2 Replies

3. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies

4. Shell Programming and Scripting

Perl cmds doesn't work in Bash shell . Plz help

Hi everyone, I have a Linux OS in my PC (older version 9). Its default shell is bash. Whenever I try to run some Perl program it throws error ! eg, if I run this simple PERL program , #!/usr/bin/perl printf "\lHello \n"; $var=3 ; printf $var; @list=(1,2,3); printf "@list";... (6 Replies)
Discussion started by: adc22
6 Replies

5. Shell Programming and Scripting

shell script, echo doesn't work

#!/bin/sh something(){ echo "Inside something" echo $1 $2 } val=$(something "Hello " "world") Output expected: Inside somethingHello world But it's not echoing. (4 Replies)
Discussion started by: cola
4 Replies

6. Shell Programming and Scripting

Replace string with sed doesn't work

Hello, Unfortunately I don't found any working solution for my problem :/ I have pass file for dovecot authorizing in this format: user@domain.tld:{SSHA}Ykx2KVG/a2FKzjnctFFC2qFnrk9nvRmW:5000:5000:::: . . ...Now, I want to write some sh script for password changing for grep'ed user, in... (5 Replies)
Discussion started by: vincenty
5 Replies

7. UNIX for Dummies Questions & Answers

find command in shell script doesn't work

Hello all, Something strange going on with a shell script I'm writing. It's trying to write a list of files that it finds in a given directory to another file. But I also have a skip list so matching files that are in that skip list should be, well uhm, skipped :) Here's the code of my... (2 Replies)
Discussion started by: StijnV
2 Replies

8. Shell Programming and Scripting

Switching user inside a shell script doesn't seem to work

Linux version : Oracle Linux 6.4 Shell : Bash The following script will be run as root. During the execution, it should switch to oracle user and execute few commands. After googling and searching within unix.com , I came up with the following syntax ## Enclosing all commands in double... (7 Replies)
Discussion started by: John K
7 Replies

9. HP-UX

Su to another user from root doesn't work within shell script

Hello I have a shell script that is run as root. Script rins ok until the point where it have to switch to user "mqm" to run other commands. It just hangs at the point of this line in the script su - mqm -c "dspmq" I ran the same commands at the terminal and they run fine. Any thoughts. (6 Replies)
Discussion started by: mo12
6 Replies

10. UNIX for Beginners Questions & Answers

Concatenate a string and number and compare that with another string in awk script

I have below code inside my awk script if ( $0 ~ /SVC IN:/ ) { svc_in=substr( $0,23 , 3); if (msg_start == 1 && msg_end == 0) { msg_arr=$0; } } else if ( $0 ~ /^SVC OUT:/ ) { svc_out=substr( $0, 9, 3); if (msg_start == 1 && msg_end == 0) ... (6 Replies)
Discussion started by: bhagya123
6 Replies
PMC(9)							   BSD Kernel Developer's Manual						    PMC(9)

NAME
pmc, pmc_get_num_counters, pmc_get_counter_type, pmc_save_context, pmc_restore_context, pmc_enable_counter, pmc_disable_counter, pmc_counter_isrunning, pmc_counter_isconfigured, pmc_configure_counter, pmc_get_counter_value, pmc_accumulate, pmc_alloc_kernel_counter, pmc_free_kernel_counter, pmc_start_profiling, pmc_stop_profiling, PMC_ENABLED -- Hardware Performance Monitoring Interface SYNOPSIS
#include <sys/pmc.h> int pmc_get_num_counters(void); int pmc_get_counter_type(int ctr); void pmc_save_context(struct lwp *l); void pmc_restore_context(struct lwp *l); int pmc_enable_counter(struct lwp *l, int ctr); int pmc_disable_counter(struct lwp *l, int ctr); int pmc_counter_isrunning(struct lwp *l, int ctr); int pmc_counter_isconfigured(struct lwp *l, int ctr); int pmc_configure_counter(struct lwp *l, int ctr, struct pmc_counter_cfg *cfg); int pmc_get_counter_value(struct lwp *l, int ctr, int flags, uint64_t *pval); int pmc_accumulate(struct lwp *l_parent, struct lwp *l_exiting); int pmc_alloc_kernel_counter(int ctr, struct pmc_counter_cfg *cfg); int pmc_free_kernel_counter(int ctr); int pmc_start_profiling(int ctr, struct pmc_counter_cfg *cfg); int pmc_stop_profiling(int ctr); int PMC_ENABLED(struct lwp *l); DESCRIPTION
Provides a machine-independent interface to the hardware performance counters which are available on several CPU families. The capabilities of these counters vary from CPU to CPU, but they basically count hardware events such as data cache hits or misses, branches taken, branched mispredicted, and so forth. Some can interrupt the processor when a certain threshold has been reached. Some can count events in user space and kernel space independently. The pmc interface is intended to allow monitoring from within the kernel as well as monitoring of userland applications. If the hardware can interrupt the CPU in a specific implementation, then it may also be used as a profiling source instead of the clock. IMPLEMENTATION NOTES
All function calls in this interface may be defined as cpp(1) macros. If any function is not implemented as a macro, its prototype must be defined by the port-specific header <machine/pmc.h>. Counters are numbered from 0 to N-1 where N is the number of counters available on the system (see pmc_get_num_counters() below). Upon a process fork, implementations must o Zero performance counters for the new process, and o Inherit any enabled performance counters. DATA TYPES
Each implementation must specify two new types: pmc_evid_t An integer type which can contain the event IDs for a given processor. pmc_ctr_t An integer type defining the value which may be contained in a given counter register. Counters are configured with the struct pmc_counter_cfg. This structure is defined as struct pmc_counter_cfg { pmc_evid_t event_id; pmc_ctr_t reset_value; uint32_t flags; }; flags are currently unused. FUNCTIONS
pmc_get_num_counters(void) Returns the number of counters present on the current system. Valid values for ctr in the interface entry points below are from zero to one less than the return value from this function. pmc_get_counter_type(int ctr) Returns an implementation-dependent type describing the specified counter. If ctr is specified as -1, returns a machine-dependent type describing the CPU or counter configuration. For example, on an ia32 architecture, it may distinguish between 586-, 686-, and K7-style counters. pmc_save_context(struct lwp *l) Saves the PMC context for the current process. This is called just before cpu_switch(9). If there is kernel PMC state, it must be maintained across this call. pmc_restore_context(struct lwp *l) Restores the PMC context for the current process. This is called just after cpu_switch(9) returns. If there is kernel PMC state, it must be maintained across this call. pmc_enable_counter(struct lwp *l, int ctr) Enables counter ctr for the specified process. The counter should have already been configured with a call to pmc_configure_counter(). This starts the counter running if it is not already started and enables any interrupts, as appropriate. pmc_disable_counter(struct lwp *l, int ctr) Disables counter ctr for the specified process. This stops the counter from running, and disables any interrupts, as appropriate. pmc_counter_isrunning(struct lwp *l, int ctr) Returns non-zero if the specified counter in the specified process is running or if the counter is running in the kernel. pmc_counter_isconfigured(struct lwp *l, int ctr) Returns non-zero if the specified counter in the specified process is configured or if the counter is in use by the kernel. pmc_configure_counter(struct lwp *l, int ctr, struct pmc_counter_cfg *cfg) Configures counter ctr according to the configuration information stored in cfg. pmc_get_counter_value(struct lwp *l, int ctr, int flags, uint64_t *pval) Returns the value of counter ctr in the space pointed to by pval. The only recognized flag is PMC_VALUE_FLAGS_CHILDREN which speci- fies that the returned counts should be accumulated values for any exited child processes. pmc_accumulate(struct lwp *l_parent, struct lwp *l_exiting) Accumulates any counter data from the exiting process p_exiting into the counters for the parent process p_parent. pmc_alloc_kernel_counter(int ctr, struct pmc_counter_cfg *cfg) Allocates counter ctr for use by the kernel and configures it with cfg. pmc_free_kernel_counter(int ctr) Returns counter ctr to the available pool of counters that may be used by processes. pmc_start_profiling(int ctr, struct pmc_counter_cfg *cfg) Allocates counter ctr for use by the kernel for profiling and configures it with cfg. pmc_stop_profiling(int ctr) Stops profiling with counter ctr. PMC_ENABLED(struct lwp *l) Returns non-zero if the given process or the kernel is using the PMC at all. SEE ALSO
pmc(1), pmc_control(2), pmc_get_info(2) HISTORY
The pmc interface appeared in NetBSD 2.0. AUTHORS
The pmc interface was designed and implemented by Allen Briggs for Wasabi Systems, Inc. Additional input on the pmc design was provided by Jason R. Thorpe. BSD
May 14, 2010 BSD
All times are GMT -4. The time now is 12:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy