The shell is a program whose primary role is to enable the user to call other programs and make them interact. In a unix context, a shell is almost always a command-line interpreter. More precisely, unless otherwise specified, a unix shell is compatible with the POSIX / Single UNIX shell ...
2
votes
3answers
29 views
Regarding separate a single file into multiple files according to line separation
Currently, I have a plain text file, A, such as
lowest priority
very high significance.
outstanding
very novel
In this file, every line contains a sentence. I want to separate this file into ...
3
votes
2answers
87 views
Why do I get error 255 when returning -1
I'm new into C++ programming and I have a very basic question.
I've noticed that when I return -1 in C++ program and then check the exit status, I get 255. Why is that?
The code is the most basic:
...
1
vote
1answer
29 views
How do I execute a remote shell script over SSH and be prompted for passwords by commands that require it in that script?
I want to do something like this
ssh [email protected] ./remote_script.sh
Contents of remote_script.sh
#!/bin/bash
hg pull
This example is much simpler than what I am actually doing. I know ...
1
vote
3answers
69 views
How to find the total number of occurrences of text and files with find command
I am trying to run the find command to find the total number of occurrences of a particular text string and also the number of files which has this text string.
What I have right now is this command.
...
6
votes
2answers
119 views
Why doesn't `echo abc^H` just print `ab`?
As I recall, ^H means Backspace. I generated it by pressing CTRL+V, CTRL+H.
So the ^H should remove the last character, as it is the same as Backspace and it should act just as if I pressed Backspace ...
0
votes
0answers
50 views
How can I configure programs to ask for password when open?
How can I configure programs to ask for a password when opened?
For example, if I'm using Akregator, Kmail, Skype or another program that could have personal information, how could I prompt for a ...
4
votes
1answer
48 views
Order of redirections
I don't quite understand how the computer reads this command.
cat file1 file2 1> file.txt 2>&1
If I understand, 2>&1 simply redirect Standard Error to Standard Output.
By that ...
1
vote
1answer
28 views
Escape text for further passing to zenity
I am going to show an error window using zenity:
/usr/bin/zenity --error --text="my error message"
The error text to pass is obtained as output from another application. This output may contain ...
1
vote
1answer
35 views
How to format a curl command for a special task?
There is a search page in a form http://site.com/search.php and it sends a search query via POST request. I want to fetch this request via curl command line tool to inspect a POST request.
The HTML ...
3
votes
2answers
88 views
Finding program name by wildcard pattern
I am trying to write a script that will attempt to find if a certain program is installed. Lets say that the program is called, myprog. The problem is that the program can be named in different ...
2
votes
1answer
58 views
Determine current shell name [closed]
Possible Duplicate:
How to test what shell I am using in a terminal?
How do I determine the current shell path or shell name?
I only really need to distinguish sh and bash, however a ...
3
votes
1answer
71 views
find usage - command line vs script
I am seeing different results from the find command between being run manually on the command line vs run in a script.
If I run the following on the command line:
find . -name '*.txt' ! -name ...
12
votes
7answers
670 views
What is the utility of the : command in shell scripting, given that it explicitly does nothing?
In the answer to this question about comments in shell scripting, it is indicated that the : is a null command that explicitly does nothing (but is not to be used for comments).
What would be the ...
3
votes
2answers
37 views
issues with GNU tail -f and combination of commands
$ tail -f /logs/filename.log | awk '!(/list)'
I am able to run this command in GNU Linux flavour
But when I written in a script it is not working.
test.ksh:
variable="/logs/filename.log | awk ...
3
votes
4answers
79 views
Recursively rename subdirectories that match a regex
I have a media server with a folder called Series. (/media/Expansion2/Series/)
In it, I have (surprise!) TV series. These are just the show names, e.g., /media/Expansion2/Series/The Big Bang Theory/
...