我想找出主目录中的目录和文件的数量,并希望在shell脚本中存储一些变量.我正在使用以下命令集.
command="ls -l | grep -c \"rahul.*patle\""
eval $command
Run Code Online (Sandbox Code Playgroud)
我想将此计数存储到一些varibale计数中.我怎样才能做到这一点.
我正在寻找使用 boto/boto3 修改 S3 存储桶策略。我在boto3中发现了两种模式可以对桶策略进行操作。
# i can get bucket policy object as follows
import boto3
s3_conn = boto3.resource('s3')
bucket_policy = s3_conn.BucketPolicy('bucket_name')
# i can make put(), load(), policy on bucket_policy object.
#similar in other way i can use following code
policy = s3_conn.get_bucket_policy(Bucket='bucket_name')
# similar to this there are two other calls put_bucket_policy and delete_bucket_policy.
Run Code Online (Sandbox Code Playgroud)
我正在寻找更新存储桶策略,我可以在其中添加更多属性。
例如。我想在以下策略的声明键下再添加一个条目。
{
"Version": "2012-10-17",
"Id": "Policy14564645656",
"Statement": [{
"Sid": "Stmt1445654645618",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::6164563645030:root"
},
"Action": "s3:Get*",
"Resource": "arn:aws:s3:::bucket_name/abc/*"
}]
} …Run Code Online (Sandbox Code Playgroud) 如何~fork()函数调用不同然后简单的fork()..我已经尝试了下面的代码..在这个偶然的孩子正在执行父节的代码.
main()
{
pid_t pid = ~fork();
int a = 2;
int *ptr = (int*)malloc(sizeof(int));
*ptr = 2;
if(pid == 0)
{
a = a + 3;
*ptr = *ptr + 2;
printf("value at a and ptr in child process : %d and %d\n" , a , *ptr);
printf("address a and ptr in child process : %p and %p\n" , &a , ptr);
}
else
{
printf("value at a and ptr in parent process : %d and %d\n" , a …Run Code Online (Sandbox Code Playgroud)