Skip to content
Advertisement

Tag: shell

Using a shell commands in c++

Here’s a terminal command: Here’s my code: The above code, when run, returns this message: How can I place the ‘/’ symbol, for this command to work correctly? Answer Your problem is not in C++. You are invoking your command with popen, and popen runs your command in sh shell, that does not support <() syntax, while in your terminal

How do I write this in a batch file

I am trying to convert a shell script into a batch file but I am stuck at this place. I am not quite sure how to convert this line into my batch file. I tried but I am not sure if I am right! Answer You can’t do command chaining like this in Batch. If I see that correctly, you

Change all non-ascii chars to ascii Bash Scripting

I am trying to write a script that take people names as an arguments and create a folder with their names. But in folder names, the non-ascii chars and whitespaces can sometimes make problem so I want to remove or change them to ascii chars. I can remove the whitespace between name and surname but I can not figure out

renaming file using shell script

I have tons of image inside a folder and it also has different file types. I have tried googling for an answer but I can’t seem to find one. I wanted the files to be named 1.jpg, 2.png, 3.gif. . . n.JPEG. Could someone help me out with this? Answer Try the command below: Make note that the command above

Can tar extraction erase brother directory ?

I made several backups on different directories with Backup Manager. Eg: /home/user1 /home/user2… It gives me some tar files. The content of a tar file looks like : I tried to test the restoration with something like : But the command above recreate all the structure inside the choosen directory. That gives /home/user1/home/user1/filname1. So I guess I should use the

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

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 way

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

Advertisement