1,891 Topics
| |
How can an array be accessed from within another function? Here is an example of some code. editarray can not seem to access values of the array from outside of the writetofile function. Is there any way to change the scope of the array? #!/bin/sh writetofile() { templine=`cat /dev/stdin` export … | |
I am trying to modify my shell sort algorithm to use Hibbard's increments rather than n/2. I know that Hibbard's increments are 2k - 1, but I can't figure out how to incorporate that into my algorithm. Any suggestions to help me move forward with this? I feel like I … | |
How to find the difference of two files and get a 3rd file with the newer information alone. for example: There are two files file1 and file2 **file1** apple mango pear **file2** apple mango pear cat and dog I need a file with **fileout** cat and dog how to achieve … | |
Why is it that no matter how long I put the sleep command or loop, cat is unable to read the file, even though the file already exsists? Is there any way of reliably waiting for the whois to finish, write to file and then read that the file exsists?? … | |
Hi all I want to login a machine remotely and doing some operation on the remote machine and then exit the remote machine by a unix shell script. I can login these two machines without passward. How can I do that? For example, my script is on machine1. that script … | |
I am new to the awk scripts. I am confused about the delimiter concept in the awk script. say delimiter is , or | or anything, then a new line is treated as a next line ? like e.g. 00|01|05|05|03|13|12|04|06|80| 03|01|01|00|52|10|12|11|05|12| So there are 10 fields in each row, and … | |
I was wondering how could I solve this problem, I have a php project in which I have tables, but I didn't use `<thead>` and `<tbody>`, but now I am using DataTable jquery plugin, and it needs that the tables have them, so I need to modify all of my … | |
hi all only the weirdest thing happened with me just now. I was debugging a shell script and I found that a step that was supposed to execute later ws getting executed prior to another step for no reason. You know any ? i mean have a look at the … | |
When using the Grep command to find a search string in a set of files, is there a way to dump the results to a text file? Also is there a switch for the Grep command that provides cleaner results for better readability, such as a line feed between each … | |
occasionally I run a backup of my phpbb forum files from the Shell command line: zip -r forum_backup ~/public_html/forum/* I'd like to add date elements to the file name, so that the zip file created is automatically formed as forum_backup_05182013.zip or something similar Thanks | |
Hi I am trying to run a python script which has this code snippet: process = subprocess.Popen('./start_ws.pl') process.wait() os.system('make') The perl script started changes environmental variables and enters into new subshell. After entering into new subshell, the commands below script os.system('make') goes unnoticed.They get executed only if i exit from … | |
i have an awk script and in the end section i create my table data with printf and i want to sort it so i used pipe then sort i am calling it like this awk -f awkscript file in bash i can get it to work the way i … | |
I'm no pro when it comes to BASH, but I have been known to shell-script my way out of a problem here and there. One of the useful things you can do is a for-loop, whether it be used on file names, script arguments, or just a string of words. … | |
I'm no pro when it comes to BASH, but I have been known to shell-script my way out of a problem here and there. One of the useful things you can do is a for-loop, whether it be used on file names, script arguments, or just a string of words. … | |
This is another useful script I came across. It prints a color-code chart in your terminal. It can help you find the color-code you are looking for, or view the current color-scheme you are using (people use it on reddit/r/unixporn to show off their system's theme, I use it to … | |
I didn't write this, the credits are in the code. It's a code-golf version, and I'm sorry about that. I am trying to 'decode' it but I don't have the skills, so the 'decoded' version doesn't have the right colors. This is an example of what you can do with … | |
hi,a question .. why does my script work as sh script.sh and not as ./script.sh ?? also,i was trying to write a script that would filter out a pattern in a .txt file and display the count of the same. Say my pattern is king, and there are 4 "king"s … | |
Hello everyone. I am trying to compile this simple code using gcc under Cygwin terminal. //A function that just returns a value// int my_function() { return 0xbaba; } I saved the code as basic.c I issue the command $gcc basic.c in the Cygwin terminal And I get the error: gcc: … | |
hi New to shell scripting. While trying hands at it I came across the operators -z -o in the if block. Any relevant info would be appreciated **if [ -z "$xa_" -o "$va_" == "yes" ]** cheers guys | |
| vi is basically used independently .....but what if vi commands are used in shell script ? I am trying to accomplish functionality of mv command using a shell script. what I want is to yank whole text of one file1 and paste it in file2. this all should happen in … |
I'M wanting to write my own command/script for compiling my c++ files. I use g++ -g -Wall filename.cpp -o filename I'M trying to figure out how I can trip of the last four characters (.cpp) from a string. Any ideas? | |
Hi Any one can guide me to the right direction. I trying to run my scripts from anywhere, how about to do it: I did this but is not working. export PATH = $PATH:/scripts/pyhon But is not working Thank you | |
Hi guys I try to run this shell in java but it never works. Process p = Runtime.getRuntime().exec(" cat *.java|sed '/import/d'|sed'/package/d'>>b.java "); when I change the cmd to something like "ls" or "open foo.java" the code will works. Any idea why? | |
i have 2 files, one file created on Windows and another was made on Ubuntu, i want to use this command: comm -12 file1 file2 how do i do that? | |
i got a string var=96.33% from 120 how do i get 96.33 from $var? | |
trying to send email from nc nc smtp.gmail.com 587 HELO there 250 mx.google.com at your service STARTTLS 220 2.0.0 Ready to start TLS MAIL FROM:<junk@example.com> connection dies.. whats wrong with the protocol im using?? | |
i want to find the total space used for the files owned by me from my current directory. i have du -sh `find ./ -user $USER -type f` which gives 8.0K ./.a 8.0K ./t 4.0K ./cat/A 4.0K ./a using -s has no effect. using du -sh by itself includes the … | |
I am (student) just switched to linux working on NoC (noxim) simulator in ubuntu 12.04 c++ is supported assignment from university, I want to make a script that call my whole program multiple times (for loop= e.g 10) and want to take average value from the functions that were called … | |
Hi, I have dates like 20130402 (y-m-d i.e 2ndApr13) Dates are 20130402, 20130404, 20130409, 20130412 if date is 20130402 out put is 20130408 , if date is 20130412 output is 201304015 dd="20130402" echo $dd This gives me current dates next monday , date -d "next monday" +%Y%m%d How to find … | |
my input file contais this text DOPC 1024 PW 30903 CL- 1 arg01 1 My output file should be DOPC 1024 PW 100 CL- 10 arg01 1 I have used this following command for the single substitution and it works well. read no_water read length sed s/"PW 30903"/"PW $no_water"/ arg01.top … |
The End.