我有一个输入字符串
[
{
"name": "administrators",
"description": "Default group for DSS administrators",
"sourceType": "LOCAL",
"admin": true,
"mayManageUDM": false,
"mayCreateProjects": false,
"mayCreateProjectsFromMacros": false,
"mayCreateProjectsFromTemplates": false,
"mayCreateProjectsFromDataikuApps": false,
"mayWriteUnsafeCode": false,
"mayWriteSafeCode": false,
"mayCreateAuthenticatedConnections": false,
"mayCreateCodeEnvs": false,
"mayCreateClusters": false,
"mayDevelopPlugins": false,
"mayEditLibFolders": false,
"mayManageCodeEnvs": false,
"mayManageClusters": false,
"mayViewIndexedHiveConnections": false,
"mayCreatePublishedAPIServices": false,
"mayWriteInRootProjectFolder": false,
"mayCreateActiveWebContent": false,
"canObtainAPITicketFromCookiesForGroupsRegex": ""
},
{
"name": "dss-se-npr",
"description": "ElevatedSupport",
"ldapGroupNames": "dss-se-npr",
"sourceType": "LDAP",
"admin": true,
"mayManageUDM": true,
"mayCreateProjects": true,
"mayCreateProjectsFromMacros": true,
"mayCreateProjectsFromTemplates": true,
"mayCreateProjectsFromDataikuApps": true,
"mayWriteUnsafeCode": true,
"mayWriteSafeCode": true,
"mayCreateAuthenticatedConnections": true,
"mayCreateCodeEnvs": true,
"mayCreateClusters": false,
"mayDevelopPlugins": true,
"mayEditLibFolders": true,
"mayManageCodeEnvs": true,
"mayManageClusters": false,
"mayViewIndexedHiveConnections": false,
"mayCreatePublishedAPIServices": true,
"mayWriteInRootProjectFolder": true,
"mayCreateActiveWebContent": true,
"canObtainAPITicketFromCookiesForGroupsRegex": ""
},
{
"name": "dss-au-npr",
"description": "Auditor",
"ldapGroupNames": "dss-au-npr",
"sourceType": "LDAP",
"admin": false,
"mayManageUDM": false,
"mayCreateProjects": false,
"mayCreateProjectsFromMacros": false,
"mayCreateProjectsFromTemplates": false,
"mayCreateProjectsFromDataikuApps": false,
"mayWriteUnsafeCode": false,
"mayWriteSafeCode": false,
"mayCreateAuthenticatedConnections": false,
"mayCreateCodeEnvs": false,
"mayCreateClusters": false,
"mayDevelopPlugins": false,
"mayEditLibFolders": false,
"mayManageCodeEnvs": false,
"mayManageClusters": false,
"mayViewIndexedHiveConnections": false,
"mayCreatePublishedAPIServices": false,
"mayWriteInRootProjectFolder": false,
"mayCreateActiveWebContent": false,
"canObtainAPITicketFromCookiesForGroupsRegex": ""
},
{
"name": "dss-ba-npr",
"description": "BusinessAnalyst",
"ldapGroupNames": "dss-ba-npr",
"sourceType": "LDAP",
"admin": false,
"mayManageUDM": false,
"mayCreateProjects": false,
"mayCreateProjectsFromMacros": false,
"mayCreateProjectsFromTemplates": false,
"mayCreateProjectsFromDataikuApps": false,
"mayWriteUnsafeCode": false,
"mayWriteSafeCode": false,
"mayCreateAuthenticatedConnections": false,
"mayCreateCodeEnvs": false,
"mayCreateClusters": false,
"mayDevelopPlugins": false,
"mayEditLibFolders": false,
"mayManageCodeEnvs": false,
"mayManageClusters": false,
"mayViewIndexedHiveConnections": false,
"mayCreatePublishedAPIServices": false,
"mayWriteInRootProjectFolder": false,
"mayCreateActiveWebContent": false,
"canObtainAPITicketFromCookiesForGroupsRegex": ""
},
{
"name": "dss-ds-npr",
"description": "DataScientist",
"sourceType": "LDAP",
"ldapGroupNames": "dss-ds-npr",
"admin": false,
"mayManageUDM": false,
"mayCreateProjects": false,
"mayCreateProjectsFromMacros": false,
"mayCreateProjectsFromTemplates": false,
"mayCreateProjectsFromDataikuApps": false,
"mayWriteUnsafeCode": false,
"mayWriteSafeCode": true,
"mayCreateAuthenticatedConnections": false,
"mayCreateCodeEnvs": false,
"mayCreateClusters": false,
"mayDevelopPlugins": false,
"mayEditLibFolders": false,
"mayManageCodeEnvs": false,
"mayManageClusters": false,
"mayViewIndexedHiveConnections": false,
"mayCreatePublishedAPIServices": false,
"mayWriteInRootProjectFolder": false,
"mayCreateActiveWebContent": false,
"canObtainAPITicketFromCookiesForGroupsRegex": ""
},
{
"name": "dss-dsfe-npr",
"description": "DataScientistFeatureEnhancement",
"ldapGroupNames": "dss-dsfe-npr",
"sourceType": "LDAP",
"admin": false,
"mayManageUDM": false,
"mayCreateProjects": false,
"mayCreateProjectsFromMacros": false,
"mayCreateProjectsFromTemplates": false,
"mayCreateProjectsFromDataikuApps": false,
"mayWriteUnsafeCode": false,
"mayWriteSafeCode": true,
"mayCreateAuthenticatedConnections": false,
"mayCreateCodeEnvs": false,
"mayCreateClusters": false,
"mayDevelopPlugins": true,
"mayEditLibFolders": false,
"mayManageCodeEnvs": false,
"mayManageClusters": false,
"mayViewIndexedHiveConnections": false,
"mayCreatePublishedAPIServices": false,
"mayWriteInRootProjectFolder": false,
"mayCreateActiveWebContent": false,
"canObtainAPITicketFromCookiesForGroupsRegex": ""
},
{
"name": "dss-ls-npr",
"description": "LeadScientist",
"ldapGroupNames": "dss-ls-npr",
"sourceType": "LDAP",
"admin": false,
"mayManageUDM": true,
"mayCreateProjects": false,
"mayCreateProjectsFromMacros": false,
"mayCreateProjectsFromTemplates": false,
"mayCreateProjectsFromDataikuApps": false,
"mayWriteUnsafeCode": false,
"mayWriteSafeCode": true,
"mayCreateAuthenticatedConnections": false,
"mayCreateCodeEnvs": false,
"mayCreateClusters": false,
"mayDevelopPlugins": false,
"mayEditLibFolders": false,
"mayManageCodeEnvs": false,
"mayManageClusters": false,
"mayViewIndexedHiveConnections": false,
"mayCreatePublishedAPIServices": false,
"mayWriteInRootProjectFolder": false,
"mayCreateActiveWebContent": false,
"canObtainAPITicketFromCookiesForGroupsRegex": ""
},
{
"name": "dss-sp-npr",
"description": "Support",
"ldapGroupNames": "dss-sp-npr",
"sourceType": "LDAP",
"admin": false,
"mayManageUDM": true,
"mayCreateProjects": true,
"mayCreateProjectsFromMacros": true,
"mayCreateProjectsFromTemplates": true,
"mayCreateProjectsFromDataikuApps": true,
"mayWriteUnsafeCode": false,
"mayWriteSafeCode": true,
"mayCreateAuthenticatedConnections": false,
"mayCreateCodeEnvs": true,
"mayCreateClusters": false,
"mayDevelopPlugins": true,
"mayEditLibFolders": true,
"mayManageCodeEnvs": true,
"mayManageClusters": false,
"mayViewIndexedHiveConnections": false,
"mayCreatePublishedAPIServices": false,
"mayWriteInRootProjectFolder": false,
"mayCreateActiveWebContent": false,
"canObtainAPITicketFromCookiesForGroupsRegex": ""
},
{
"name": "dss-rm-npr",
"description": "ReleaseManager",
"ldapGroupNames": "dss-rm-npr",
"sourceType": "LDAP",
"admin": false,
"mayManageUDM": false,
"mayCreateProjects": false,
"mayCreateProjectsFromMacros": false,
"mayCreateProjectsFromTemplates": false,
"mayCreateProjectsFromDataikuApps": false,
"mayWriteUnsafeCode": false,
"mayWriteSafeCode": false,
"mayCreateAuthenticatedConnections": false,
"mayCreateCodeEnvs": false,
"mayCreateClusters": false,
"mayDevelopPlugins": false,
"mayEditLibFolders": false,
"mayManageCodeEnvs": false,
"mayManageClusters": false,
"mayViewIndexedHiveConnections": false,
"mayCreatePublishedAPIServices": false,
"mayWriteInRootProjectFolder": false,
"mayCreateActiveWebContent": false,
"canObtainAPITicketFromCookiesForGroupsRegex": ""
},
{
"name": "dss-te-npr",
"description": "Tester",
"ldapGroupNames": "dss-te-npr",
"sourceType": "LDAP",
"admin": false,
"mayManageUDM": false,
"mayCreateProjects": false,
"mayCreateProjectsFromMacros": false,
"mayCreateProjectsFromTemplates": false,
"mayCreateProjectsFromDataikuApps": false,
"mayWriteUnsafeCode": false,
"mayWriteSafeCode": false,
"mayCreateAuthenticatedConnections": false,
"mayCreateCodeEnvs": false,
"mayCreateClusters": false,
"mayDevelopPlugins": false,
"mayEditLibFolders": false,
"mayManageCodeEnvs": false,
"mayManageClusters": false,
"mayViewIndexedHiveConnections": false,
"mayCreatePublishedAPIServices": false,
"mayWriteInRootProjectFolder": false,
"mayCreateActiveWebContent": false,
"canObtainAPITicketFromCookiesForGroupsRegex": ""
}
]
我需要将字符串复制到/dss/data/groups.txt
我在 Set-Groups.sh 中执行以下操作
echo $InputConf > /dss/data/groups.txt
但是我没有获取所有内容,而只获取了InputString的第一个字符。
如何将整个字符串复制到groups.txt?
答案1
首先,如果InputConf
实际上保存了整个字符串,您应该通过以下方式将其打印到屏幕上:
echo $InputConf
如果您只得到第一个字符,则问题出在您的脚本早期。
包含空格的字符串变量需要用引号括起来。由于您在字符串中使用了双引号,因此在分配给时使用单引号将整个字符串括起来InputConf
。