Anyone have an example of a simple shell script that solicits a (Y)es or (N)o response from the user. If the response is 'Y' display a message on the screen that thanks the user for the positive response. If the response is 'N' display a message that thanks the user for the negative response. If... (15 Replies)
Hi, I need help writing a unix script to change the time in the server automatically when it reaches a specified time.
Only on the 14th of april, when the time becomes midnight (00:00:00), I need the server to change the time automatically to 23:30:00 and start working on as usual with a... (2 Replies)
I whant write the script of monitoring my servers on night-active users.
He must loging all user actions, when user login, when logout, when he do su etc.
But i don't know with what to begin :( How command i can use? awk, sed, last
And what logs i can use too? /var/log/messages, /var/log/secure... (1 Reply)
Is it possible to write files in a Windows application, in UFS, onto a CDROM that can then be read by a SUN workstation? If so, can anyone point me in the direction of an application that can let me do this? Thanks. (1 Reply)
Here is the script I am trying to write along with my answer I wrote. Please help me understand why it doesn't work.
Create an executable script file called "newname" that will perform the followings:
1. Rename a file upon the user's request. If the file exists, prompt the user for... (1 Reply)
Hi,
I have written a script which converts a give hexdecimal value to binary value in perl. But now, the problem is I should read every bit of it ( if its 10101010, i should read the value in each position and if the value in that position is 1 i should print a string and should exit if its... (1 Reply)
Hey everyone
Can anyone please write me a script to display numbers in descending order dynamically i.e if the user enter a number say 100 then the output should be like 100 99 ....so on till 0
I tried using the logic as for ((i =1; i<=100; i--) but the it goes into a infinite loop since even the... (7 Replies)
Experts,
I am newbie in shell scripting. I want to write Bash shell scripts corresponding to windows bat files. I have installed cygwin at c:\cygwin and i am trying to crate the sh file using vi editor. i am not able to understand how to use linux/unix convention for the code. following is my... (15 Replies)
:wall:
Can't seem to figure out how to fix this please help
its not starting over like I would like it to
When I enter in "Date" or "Time" nothing comes
Also if you can tell me the commands for the other 3 stuff that would be much appreciated
#!/bin/bash
clear
while ; do
echo... (8 Replies)
Discussion started by: nowruzr
8 Replies
LEARN ABOUT LINUX
erl_format
erl_format(3erl) C Library Functions erl_format(3erl)NAME
erl_format - Create and Match Erlang Terms
DESCRIPTION
This module contains two routines - one general function for creating Erlang terms and one for pattern matching Erlang terms.
EXPORTS
ETERM * erl_format(FormatStr, ... )
Types char *FormatStr;
This is a general function for creating Erlang terms using a format specifier and a corresponding set of arguments, much in the way
printf() works.
FormatStr is a format specification string. The set of valid format specifiers is as follows:
* ~i - Integer
* ~f - Floating point
* ~a - Atom
* ~s - String
* ~w - Arbitrary Erlang term
For each format specifier that appears in FormatStr , there must be a corresponding argument following FormatStr . An Erlang term is
built according to the FormatStr with values and Erlang terms substituted from the corresponding arguments and according to the
individual format specifiers. For example:
erl_format("[{name,~a},{age,~i},{data,~w}]",
"madonna",
21,
erl_format("[{adr,~s,~i}]","E-street",42));
This will create an (ETERM *) structure corresponding to the Erlang term: [{name,madonna},{age,21},{data,[{adr,"E-street",42}]}]
The function returns an Erlang term, or NULL if FormatStr does not describe a valid Erlang term.
int erl_match(Pattern, Term)
Types ETERM *Pattern,*Term;
This function is used to perform pattern matching similar to that done in Erlang. Refer to an Erlang manual for matching rules and
more examples.
Pattern is an Erlang term, possibly containing unbound variables.
Term is an Erlang term that we wish to match against Pattern .
Term and Pattern are compared, and any unbound variables in Pattern are bound to corresponding values in Term .
If Term and Pattern can be matched, the function returns a non-zero value and binds any unbound variables in Pattern . If Term Pat-
tern do not match, the function returns 0. For example:
ETERM *term, *pattern, *pattern2;
term1 = erl_format("{14,21}");
term2 = erl_format("{19,19}");
pattern1 = erl_format("{A,B}");
pattern2 = erl_format("{F,F}");
if (erl_match(pattern1, term1)) {
/* match succeeds:
* A gets bound to 14,
* B gets bound to 21
*/
...
}
if (erl_match(pattern2, term1)) {
/* match fails because F cannot be
* bound to two separate values, 14 and 21
*/
...
}
if (erl_match(pattern2, term2)) {
/* match succeeds and F gets bound to 19 */
...
}
erl_var_content() can be used to retrieve the content of any variables bound as a result of a call to erl_match() .
Ericsson AB erl_interface 3.7.3 erl_format(3erl)