I’m new in linux and I’m building a program that receives the name of a process, gets its PID (i have no problem with that part) and then pass the PID to the kill command but its not working. It goes something like this: Can someone tell me why it isn’t killing it ? I know that there are som…
Tag: bash
Why is echo showing the command itself and not the command output
Why is echo showing the command and not the output of the command once I start using it in a FOR I loop? For example this command works But not in a FOR I loop I want the command to print the first field so then I can add other functionality to the For I loop. Thanks EDIT — Not
Reasoning behind ‘sort’ core util’s key (-k) syntax
When using the sort function in a shell, it seems the preferred syntax for the -k option when sorting via only one field is, for example, -k5n,5. What’s the advantage of the ,5 in this case? -k5n works the same, or at least seems to for me. Refs: The man page seems to prefer this but also suggests it is
Edit field with date in .csv
I have .csv file with lines like this: and i need to change all date and time to this: I think it’s possible using awk and date but until now nothing worked. Answer Some perl: That removes the last 2 comma-separated fields from each line, deletes the fractional time and timezone, reformats the time and …
Getting Output from Cisco C40 via Bash
Background We have a handful of Cisco C40s that I’m trying to automate via bash (although I’d be open to alternatives). I need to log into it, dial an IP, get back the call ID that’s returned, and then use that CallID to send a DTMF tone to the far end. I’m able to get about 90% of the…
How to write a bash script to merge several file into one
I am using the Linux system. I would like to write a script to do these things below. I have few folders named Folder 1, Folder 2, Folder 3 …Folder 100 saved in test.In each folder I have a file named file.txt. How can I write a script to merge the files together. I type one script by myself, However
issue in transfer file to remote machine on executing shell script through php
i am executing script file through php as shell_exec(sh script.sh) script.sh is the name of the script file. This script is used to transferring file say ‘abc’ to remote machine. When I execute script file through terminal as ./script.sh it successfully transfer file to remote machine but when exe…
Starting hadoop – command not found
I have zero experience in hadoop and trying to set up hadoop in ec2 environment. After formatted the filesystem, I tried to start hadoop and it keeps saying command not found. I think I have tried every advice I found on stackoverflow previous questions/answers. Here is the line I am having trouble with: I ha…
Use php exec to launch a linux command with brace expansion
How can I force the php exec() to interpret the linux brace expansion? I am encountering a strange behavior, and did not find a way to fix it the way I want. I want to execute a linux command containing brace expression to select a batch of files, from php I am using php to generate a “random” num…
Retrieve string between characters and assign on new variable using awk in bash
I’m new to bash scripting, I’m learning how commands work, I stumble in this problem, I have a file /home/fedora/file.txt Inside of the file is like this: What I wanted is to retrieve words between “[” and “]”. What I tried so far is : I can print the words between “[…