So i have a tcl code that i need to run in ns2. As we all know i just have to type 'ns abc.tcl' in terminal. In my abc.tcl code i have a variable x which i need to change and run the code. Is there any way i can write a script that will change the value of x and run 'ns abc.tcl' in terminal, then change the value again and run 'ns abc.tcl' in terminal again for a set of values for x. I believe i need to write a shell script but i don't know anything about that. Can you tell me the format i should write the script in like what should i write first and where do i write my values of x and how to make it run 'ns abc.tcl in terminal: 'function()' 'do' 'done' etc... If you can direct me to specific links about that would be helpful.
Shell script to create loop for command
175 Views Asked by instame At
1
There are 1 best solutions below
Related Questions in SHELL
- passing text with \n as one argument in shell
- Delete the extra space after special character in all the lines of text file
- Calling a python function with options from shell script
- bc: prevent "divide by zero" runtime error on multiple operations
- schedule and automate sqoop import/export tasks
- How can launch an external process from java and still be able to interact with this process?
- Linux find files where mtime and ctime are not equal
- Find all files contained into directory named
- Quick way to remove all folders titled CVS in a directory and it's subdirectories?
- shell process not exiting on `exit` inside `$()`
- How to set environment variables with a forward slash in the key
- System 'bash -ic' stuck when I hit ctrl+c
- bash functions returns "command not found"
- Why does pattern "*.so?(.*)" produce a syntax error in a script but not on command line?
- retrieve plaintext password from file using bash command
Related Questions in UNIX
- passing text with \n as one argument in shell
- C std library don't appear to be linked in object file
- How to split a directory into parts without compressing or archiving?
- Momentjs get current GMT unix time
- Timing packets on a traffic server
- man pages for c variable types
- Blocking in pthread_join()
- PWX-00001 Error opening repository "dtlmsg.txt". RCs = 268/150/2
- Unix c program to calculate pi using threads
- How to perform parallel processes for different groups in a folder?
- Set aliases globally for all users
- wmic csproduct get UUID equivalent for Unix and Mac?
- Send alert for 80% threshold comparing two values from Disk partition
- Unix - Tail Utility would open the file or not
- Redirect Outward of unix os commands to html page
Related Questions in TCL
- Missing title bar when using wm manage and wm forget
- Questions on Regex algorithm (not necessarily EXPECT related)
- format in TCL in not working correctly
- Pick out certain lines from files
- Non-Greedy regex acts greedy based on the position of atoms in regex
- how to install Expect for windows using ActiveTCL 8.6 x86
- How to change link color in NS2?
- fconfigure refuses to set baud rate to 921600
- Search file by placement of element in a line
- Returning Some Variable from a "proc" in Tcl
- What is TCL's pattern for translating GUI actions to TCL statements
- Is the Tcl `file dirname` command usable for URL?
- synopsys dc_shell get_attribute number of digits
- Search for element after a designated string
- Using $variable in Parenthesis in Tcl (proc)
Related Questions in NS2
- UDP congestion control in NS2
- How to change link color in NS2?
- How can i set next hop of nodes in NS2?
- Adding tree routing protocol in ns 2.32
- How to use node's coordinates in AODV packets in NS-2?
- Shell script to create loop for command
- Calculating overall average time taken to send a packet from source to destination when a all the nodes in the network are moving
- can't read "ns_": no such variable
- Ant Hoc net simulation on ns2
- Data mules in ns2
- AODV CODE explanation NS2
- TCP Choosing optimal window size?
- Network simulator - reading packets from file
- how to implement particular message format in NS-2
- Passing the repeatTime from ns2 to .cc file
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
The easiest way, providing it works, is to pass the value in as an argument.
Invoke your code as
ns abc.tcl TheValueToPassIn.Access the value within your code by indexing into the
argvglobal variable withlindex, which should contain a list of all arguments after the script name:However, it's possible that that won't work (depending on exactly what the
nsprogram does). If so, pass the value in inside an environment variable:Invoke your code as
MYVAR=TheValueToPassIn ns abc.tcl.Access the value within your code by looking in the global
envarray:There are many other ways to do it, but those two are very easy.